如何以编程方式获取 UWP 标题栏颜色?
我可以轻松设置自定义标题栏颜色:
ApplicationView.GetForCurrentView().TitleBar.BackgroundColor
ApplicationView.GetForCurrentView().TitleBar.ForegroundColor
但是如何获取系统标题栏的颜色呢?
例如。如果用户设置在标题栏上显示颜色 选项并使用黄色 作为 Windows Accent Color,则 UWP 应用标题栏 BackgroundColor
为黄色。
但是 ApplicationView.GetForCurrentView().TitleBar.BackgroundColor
返回 null。
最佳答案
这是强调色。 您可以通过编程方式获取它
var color = new UISettings().GetColorValue(UIColorType.Accent);
或者试试
var color = (Color)Resources["SystemAccentColor"];
关于c# - 如何以编程方式获取 UWP 标题栏默认颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41614597/