Click here to Skip to main content
15,898,937 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: How does Silverlight find its Web service when the latter is in an assembly? Pin
Abhinav S17-May-10 18:12
Abhinav S17-May-10 18:12 
GeneralRe: How does Silverlight find its Web service when the latter is in an assembly? Pin
fjparisIII18-May-10 6:42
fjparisIII18-May-10 6:42 
AnswerRe: How does Silverlight find its Web service when the latter is in an assembly? Pin
shiznit77019-May-10 7:17
shiznit77019-May-10 7:17 
GeneralRe: How does Silverlight find its Web service when the latter is in an assembly? Pin
fjparisIII19-May-10 7:44
fjparisIII19-May-10 7:44 
QuestionHow to get access to main window controls in WPF Pin
Majid Shahabfar17-May-10 5:11
Majid Shahabfar17-May-10 5:11 
AnswerRe: How to get access to main window controls in WPF Pin
Abhinav S17-May-10 17:42
Abhinav S17-May-10 17:42 
GeneralRe: How to get access to main window controls in WPF Pin
Majid Shahabfar18-May-10 9:14
Majid Shahabfar18-May-10 9:14 
QuestionSL3 Resource Dictionaries [SOLVED] Pin
#realJSOP17-May-10 3:50
professional#realJSOP17-May-10 3:50 
I'm working on a SL3 Navigation App in VS2008. By default it created Assets/Styles.xaml. I have been trying to reorganize my xaml resources by moving groups of resources into logically assigned files, and I can't resolve the following issue:

I created a file called "FMBrushesAndColors.XAML", and I was careful to duplicate the property settings that are used by the original "Styles.XAML" fiule.

I then added the file to the App.XAML MergedDictionaries group.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Assets/FMColorsAndBrushes.xaml"/>
            <ResourceDictionary Source="Assets/Styles.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>


The problem is that when the app loads, it claims it can't find resources that are defined in that new resource file.

I've also tried creating a MergedDictionaries section in the original Styles.XAML file (and removing the resource line from App.XAML), but I get the same error.

I then tried adding the following code to the app.xaml.cs file, but it throws an InvalidOperationException.

public App()
{
	this.Startup += this.Application_Startup;
	this.UnhandledException += this.Application_UnhandledException;
	
	AddResourceDictionary("Views/FMColorsAndBrushes.xaml");<br />

	InitializeComponent();
}

<br />
private void AddResourceDictionary(string filename)
{
	ResourceDictionary dict = new ResourceDictionary();
	try
	{
		dict.Source = new Uri(filename, UriKind.RelativeOrAbsolute);
		if (dict != null)
		{
			this.Resources.MergedDictionaries.Add(dict);
		}
	}
	catch (Exception ex)
	{
	}
}



Does anyone know the secret to using multiple resource dictionaries in a silverlight app?

SOLUTION =====================================

Alright. I was using some of the resources defined in one dictionary in two other two dictionaries. The rules are as follows (as near as I can determine):

Give dictionaries A, B, and C...

0) If A requires a resource in B, you need to include the following in dictionary A:

    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/AssembblyName;component/Assets/B.xaml"/>
</ResourceDictionary.MergedDictionaries>


1) To merge dictionaries A and C, you need to do this in the app.xaml:

<Application.Resources>
    <ResourceDictionary>
	<ResourceDictionary.MergedDictionaries>
	    <ResourceDictionary Source="Assets/A.xaml"/>
	    <ResourceDictionary Source="Assets/C.xaml"/>
	</ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>


Notice that you don't have to include B in app.xaml.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

AnswerRe: SL3 Resource Dictionaries Pin
Abhinav S17-May-10 7:04
Abhinav S17-May-10 7:04 
GeneralRe: SL3 Resource Dictionaries Pin
#realJSOP17-May-10 7:07
professional#realJSOP17-May-10 7:07 
GeneralRe: SL3 Resource Dictionaries Pin
Abhinav S17-May-10 7:56
Abhinav S17-May-10 7:56 
GeneralRe: SL3 Resource Dictionaries Pin
#realJSOP17-May-10 8:13
professional#realJSOP17-May-10 8:13 
GeneralRe: SL3 Resource Dictionaries Pin
#realJSOP17-May-10 8:55
professional#realJSOP17-May-10 8:55 
GeneralRe: SL3 Resource Dictionaries Pin
Abhinav S17-May-10 16:16
Abhinav S17-May-10 16:16 
GeneralRe: SL3 Resource Dictionaries Pin
blackjack215018-May-10 1:35
blackjack215018-May-10 1:35 
GeneralRe: SL3 Resource Dictionaries Pin
#realJSOP19-May-10 0:09
professional#realJSOP19-May-10 0:09 
QuestionShapes in Rich text box Pin
r i s h a b h s17-May-10 1:46
r i s h a b h s17-May-10 1:46 
AnswerRe: Shapes in Rich text box Pin
r i s h a b h s17-May-10 18:43
r i s h a b h s17-May-10 18:43 
AnswerRe: Shapes in Rich text box Pin
Abhinav S17-May-10 20:00
Abhinav S17-May-10 20:00 
GeneralRe: Shapes in Rich text box Pin
r i s h a b h s18-May-10 6:40
r i s h a b h s18-May-10 6:40 
Questionhow to cache third party images in silverlight . Pin
sandeep.cec14-May-10 22:24
sandeep.cec14-May-10 22:24 
AnswerRe: how to cache third party images in silverlight . Pin
Abhinav S15-May-10 8:09
Abhinav S15-May-10 8:09 
QuestionResizing GridSplitter Pin
kunthavai14-May-10 11:38
kunthavai14-May-10 11:38 
AnswerRe: Resizing GridSplitter Pin
AspDotNetDev14-May-10 12:51
protectorAspDotNetDev14-May-10 12:51 
AnswerRe: Resizing GridSplitter Pin
AspDotNetDev14-May-10 12:56
protectorAspDotNetDev14-May-10 12:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.