I can't seem to be able to add a merged dictionary to a collection of merged dictionaries within XAML.
Theme.xaml
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Mine;component/Themes/Palette.Blue.xaml"/>
<ResourceDictionary Source="/Mine;component/Themes/Template.xaml"/>
</ResourceDictionary.MergedDictionaries>
Application Resources
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Mine;component/Themes/Theme.xaml"/>
<!--
<ResourceDictionary Source=="/Mine;component/Themes/Palette.Blue.xaml"/>
<ResourceDictionary Source="/Mine;component/Themes/Template.xaml"/>
-->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Note: if I put both ResourceDictionaries in the Appication.Resources MergedDictionary (comment out the theme.xaml and uncomment the other two dictionaries) they both load correctly. However, the way our resources are defined, this may mean that quite a few resources will be loaded, and for dynamic loading I'd like to be able to define templates.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…