簡體   English   中英

如何以編程方式獲取 UWP 標題欄默認顏色

[英]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 標題欄BackgroundColorYellow 但是ApplicationView.GetForCurrentView().TitleBar.BackgroundColor返回null

win 10 顏色設置截圖

這是重點色。 您可以通過編程方式獲取

var color = new UISettings().GetColorValue(UIColorType.Accent);

或嘗試

var color = (Color)Resources["SystemAccentColor"];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM