For some reason including a ResourceDictionary into the Themes/generic.xaml does not behave the same as including a ResourceDictionary into App.xaml.
If you include a ResouceDictionary into Themes/generic.xaml you will receive an exception telling you that the dictionary cannot be assigned to property ‘Source’ of object, yada, yada, yada, very informative.
Exception:’MyDictionary.xaml’ value cannot be assigned to property ‘Source’ of object ‘System.Windows.ResourceDictionary’. Cannot loc
ate resource ‘mydictionary.xaml’. Error at object ‘System.Windows.ResourceDictionary’, Line 9 Position 23.
What the exception is trying to tell you is that the included ResourceDictionary file was not found on the output folder, (meaning that it was expected to be an external resource).
What to do then, instead of:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=”MyDictionary.xaml” />
</ResourceDictionary.MergedDictionaries>
You should write it like this (specifying that the included resource is embedded into the assembly):
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=”/My.Controls;component/themes/MyDictionary.xaml” />
</ResourceDictionary.MergedDictionaries>
Posted by andresd
Posted by andresd
Posted by andresd 



