如果我需要覆盖画笔中的颜色,我会将其设置为App.xaml,如下所示:
<Application.Resources>
...
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="PivotHeaderForegroundUnselectedBrush" Color="#A7A9AC" />
<SolidColorBrush x:Key="PivotHeaderForegroundSelectedBrush" Color="Black" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
...
</Application.Resources>
编辑器强调<ResourceDictionary>
说:“每个字典条目必须有一个关联的密钥”。
如何解决这个问题?
答案 0 :(得分:3)
我解决了这个问题,感谢@Alan Yao - MSFT。
Maybe you have more things there?
,我还写了其他内容,写入ResourceDictionary
。通过ResourceDictionary
内的Application.Resources
父项,我解决了问题。
答案 1 :(得分:0)
ResourceDictionary必须放在应用程序资源中:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="PivotHeaderForegroundUnselectedBrush" Color="#A7A9AC" />
<SolidColorBrush x:Key="PivotHeaderForegroundSelectedBrush" Color="Black" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Application.Resources>