The WPF documentation on MergedDictionaries
suggests that if you load two ResourceDictionaries
in XAML, the second loaded one will be able to reference the first. The Windows Phone documentation on MergedDictionaries
does not explicity state this but I assume the same rules apply. However the following does not work in my Windows Phone App.xaml,
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="View/ThemeDictionaries/LightThemeResourceDictionary.xaml"/>
<ResourceDictionary Source="View/ThemeDictionaries/MainResourceDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
The debug says the MainResourceDictionary line cannot reference SubTitleTextColor
which is defined in LightThemeResourceDictionary - I have checked the spelling of the reference.
Is this type of loading not possible in Windows Phone? How do I work around it?
Based on the Silverlight Resources documentation (much more applicable than the WPF ones), this scenario won't work. There are 2 ways to get around this:
List<ResourceDictionary>
that will manually merge them into one giant ResourceDictionary
and set the application's resources to it.