How to reference a separate Assembly’s ResourceDictionary in Universal Apps
January 11, 2015Figuring this out took me nearly an hour today, so I considered it worth blogging about it.
If you have an assembly which contains a ResourceDictionary that you want to use in another assembly: here’s what you do.
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="ms-appx:///AssemblyName/FolderName/DictionaryName.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
Actually it’s the same pattern (ms-appx:///) which is used for referencing images and other content in Universal Apps.
Here’s an example, how the resources exported by my development framework Newport can be used.
<ResourceDictionary Source="ms-appx:///Newport.Universal/Controls/ResourceDictionary.xaml"/>