在 Windows 10 UWP 中更改强调色 [英] Change Accent Color in Windows 10 UWP

查看:28
本文介绍了在 Windows 10 UWP 中更改强调色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的不想在我的应用程序中使用用户在 Windows 中选择的强调色,而是想要有我自己的颜色显示.我可以通过创建新样式在所有项目上手动更改它,但它只是在普通控件中的很多地方,在应用程序级别上做会很好.

I dont really want to use the accent color that the user has chosen in Windows in my app, and instead want to have my own color show. I can change it manually on all the items by by making new styles, but it is just in so many places in the normal controls, that it would be nice to do on the app level.

我尝试设置 <SolidColorBrush x:Key="SystemAccentColor" Color="#FFCB2128"/> 但由于某种原因,它没有注意到某些项目,而将其他项目如视频控件变成灰色.

I tried setting <SolidColorBrush x:Key="SystemAccentColor" Color="#FFCB2128" /> but for some reason that does noting on some items and turns others like the video controls gray.

推荐答案

在 Win10 UWP 上,系统强调色被定义为 ThemeResource SystemControlHighlightAccentBrush.您可以按如下方式覆盖它.

On Win10 UWP, System Accent color is defined as ThemeResource SystemControlHighlightAccentBrush. You can override it as following.

<ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary x:Key="Default">
        <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Orange" />
    </ResourceDictionary>
    <ResourceDictionary x:Key="Dark">
        <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Green" />
    </ResourceDictionary>
    <ResourceDictionary x:Key="Light">
        <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Blue" />
    </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

这篇关于在 Windows 10 UWP 中更改强调色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆