如果样式使用TargetType. 如果它们被放置在 Application.Resources 中,那么它们甚至会应用到模板内部,否则情况并非如此。要使用主题,您可以在以下位置引用它App.xaml:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/ShinyRed.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅MSDN 上的资源概述。