簡體   English   中英

不在焦點時保留自定義標題欄顏色

[英]Retain custom titlebar color when not in focus

我有一個帶有自定義標題欄背景和前景色的UWP應用。 效果很好,但當應用程序不清晰時,它將標題欄變回原始的白色。

public MainPage()
    {
        this.InitializeComponent();

        Windows.UI.ViewManagement.ApplicationViewTitleBar titleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar;
        titleBar.BackgroundColor = Windows.UI.Colors.Black;
        titleBar.ForegroundColor = Windows.UI.Colors.White;
        titleBar.ButtonBackgroundColor = Windows.UI.Colors.Black;
        titleBar.ButtonForegroundColor = Windows.UI.Colors.White;     
    }

即使應用程序不清晰,如何保留自定義標題欄顏色?

為此有不活動的顏色。

titleBar.InactiveBackgroundColor = titleBar.BackgroundColor = Windows.UI.Colors.Black;
titleBar.InactiveForegroundColor = titleBar.ForegroundColor = Windows.UI.Colors.White;
titleBar.ButtonInactiveBackgroundColor = titleBar.ButtonBackgroundColor = Windows.UI.Colors.Black;
titleBar.ButtonInactiveForegroundColor = titleBar.ButtonForegroundColor = Windows.UI.Colors.White;

這些按鈕也具有“ 懸停”和“ 按下”顏色設置。

在此處輸入圖片說明

暫無
暫無

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

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