Application.Resources
The help page in MSDN is at:
http://msdn.microsoft.com/en-us/library/ms746624.aspx?lc=1033
I originally got this wrong, by trying to create a new Resource dictionary and placing the XAML <Application.Resources> into this new file.
When you create a new WPF application, an Application.xaml file is created automatically. This already contains an <Application.Resources> section, so just add in your new resources direct into here.
How to use Resource Dictionaries
Create Resource Dictionary, possibly putting it in a different folder, perhaps named Assets.
Then in Application.xaml
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=”Assets\Dictionary1.xaml” />
<ResourceDictionary Source=”Assets\Dictionary2.xaml” />
</ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
</Application.Resources>
<–Seem to be only able use Resoure Dictionary or Application.Resources not a mix of both
So Following line is invalid, because of following ResourceDictionaries
May be possible if a Key is used somewhere>–>
<!–<Brush x:Key=”myColorYellow”>Yellow</Brush>–>
Error 1
If on a window or page and “The designer does not support loading dictionaries that mix “ResourceDictionary” items without a key and other items in the same collection”
Solution 1:
Put the other resources inside the ResourceDictionary even if they are designed there.
With thanks to http://stackoverflow.com/questions/3818000/how-to-define-resources-and-a-mergedictionary-with-a-key-in-a-sl4-page
How to store Resource Dictionaries in a separate assembly and use them
In the following example of use. RDL01 is an external assembly. The word “component” is there as seen here.
<StackPanel>
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=”/RDL01;component/Dictionary1.xaml”></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<Button Content=”Hello” Width=”100″ Height=”50″></Button>
</StackPanel>
How to use the Property Windows for controls to use and extract Resources
Use extract value to resource