首页 > 解决方案 > UWP 全局覆盖默认画笔

问题描述

我正在尝试SolidColorBrush为我的整个应用程序覆盖一些默认值:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Light">
                <SolidColorBrush x:Key="ListViewItemBackgroundSelected" Color="{ThemeResource SystemAccentColorLight1}"/>
                <SolidColorBrush x:Key="ListViewItemBackgroundSelectedPointerOver" Color="{ThemeResource SystemAccentColorLight2}"/>
            </ResourceDictionary>
            <ResourceDictionary x:Key="Dark">
                <SolidColorBrush x:Key="ListViewItemBackgroundSelected" Color="{ThemeResource SystemAccentColorDark1}"/>
                <SolidColorBrush x:Key="ListViewItemBackgroundSelectedPointerOver" Color="{ThemeResource SystemAccentColorDark2}"/>
            </ResourceDictionary>
        </ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary>
</Application.Resources>

当我将这些特定添加SolidColorBrush到我ThemeDictionary的 in App.xaml(我在那里放置了更多资源)时,它没有任何效果。
但是,当我将它ThemeDictionary放在Application.ResourcesaPage中时,ListView它确实有效果。

这里有什么问题,我该如何解决?

标签: xamluwpuwp-xaml

解决方案


推荐阅读