[英]How to get UWP title bar default colors programmatically
如何以編程方式獲取 UWP 標題欄顏色?
我可以輕松設置自定義標題欄顏色:
ApplicationView.GetForCurrentView().TitleBar.BackgroundColor
ApplicationView.GetForCurrentView().TitleBar.ForegroundColor
但是如何獲取系統標題欄顏色呢? 例如,如果用戶設置Show color on title bar選項並使用Yellow作為 Windows Accent Color,則 UWP App 標題欄BackgroundColor
為Yellow 。 但是ApplicationView.GetForCurrentView().TitleBar.BackgroundColor
返回null 。
這是重點色。 您可以通過編程方式獲取
var color = new UISettings().GetColorValue(UIColorType.Accent);
或嘗試
var color = (Color)Resources["SystemAccentColor"];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.