[英]How to get UWP title bar default colors programmatically
How to get UWP title bar color programmatically?如何以编程方式获取 UWP 标题栏颜色?
I can easy set custom title bar colors with:我可以轻松设置自定义标题栏颜色:
ApplicationView.GetForCurrentView().TitleBar.BackgroundColor
ApplicationView.GetForCurrentView().TitleBar.ForegroundColor
But how to get system title bar colors?但是如何获取系统标题栏颜色呢? Eg If user set Show color on title bar option and use Yellow as Windows Accent Color then UWP App title bar
BackgroundColor
is Yellow .例如,如果用户设置Show color on title bar选项并使用Yellow作为 Windows Accent Color,则 UWP App 标题栏
BackgroundColor
为Yellow 。 But ApplicationView.GetForCurrentView().TitleBar.BackgroundColor
return null .但是
ApplicationView.GetForCurrentView().TitleBar.BackgroundColor
返回null 。
It's AccentColor.这是重点色。 You can get it programmatically
您可以通过编程方式获取
var color = new UISettings().GetColorValue(UIColorType.Accent);
or try或尝试
var color = (Color)Resources["SystemAccentColor"];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.