繁体   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