加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

xaml – 覆盖主题画笔Windows 10 UWP

发布时间:2020-12-14 04:33:25 所属栏目:Windows 来源:网络整理
导读:我试图在 Windows 10中覆盖一些样式颜色,但我无法让它工作. 我的app.xaml看起来像这样: ResourceDictionary ResourceDictionary.MergedDictionaries ResourceDictionary Source="Resources.xaml"/ /ResourceDictionary.MergedDictionaries ResourceDictiona
我试图在 Windows 10中覆盖一些样式颜色,但我无法让它工作.

我的app.xaml看起来像这样:

<ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Resources.xaml"/>
        </ResourceDictionary.MergedDictionaries>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Default" Source="Theme.xaml"/>
        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
</Application.Resources>

而我的Theme.xaml看起来像这样

<ResourceDictionary
x:Key="Default"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<SolidColorBrush x:Key="ListBoxBackgroundThemeBrush" Color="Transparent" />
<SolidColorBrush x:Key="ListBoxFocusBackgroundThemeBrush" Color="Transparent" />
<SolidColorBrush x:Key="ListBoxItemPressedBackgroundThemeBrush" Color="Transparent" />
<SolidColorBrush x:Key="ListBoxItemSelectedForegroundThemeBrush" Color="Transparent" />
<SolidColorBrush x:Key="ListBoxItemSelectedBackgroundThemeBrush" Color="Transparent" />
<SolidColorBrush x:Key="FocusVisualBlackStrokeThemeBrush" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonForegroundThemeBrush" Color="Red" />
<SolidColorBrush x:Key="ScrollBarPanningBackgroundThemeBrush" Color="Red" />
<SolidColorBrush x:Key="ButtonPressedBackgroundThemeBrush" Color="White"/>

<SolidColorBrush x:Key="SearchBoxHitHighlightSelectedForegroundThemeBrush" Color="Red"/>
<SolidColorBrush x:Key="SearchBoxHitHighlightForegroundThemeBrush" Color="Pink"/>

但是它不起作用,它不会覆盖任何地方的风格.

您设置的样式适用于Windows 8应用程序.通用Windows应用程序使用的样式大大简化.

找到它们的最简单的方法是将您的ListBox添加到页面,在设计器中右键单击它,然后选择编辑模板…创建模板的副本并查看使用的名称.

所有的控件现在都可以使用相同的画笔,而不是具有特定的控件.

例如,ListBox为其前景,背景和BorderBrush使用以下画笔:

> SystemControlForegroundBaseHighBrush> SystemControlBackgroundChromeMediumLowBrush> SystemControlForegroundBaseHighBrush

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读