Retain custom titlebar color when not in focus

I have a UWP app with custom titlebar background & foreground color. It works great except when the app is not in focus it will turn the titlebar back to the original white color.

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;     
    }

How do I retain the custom titlebar color even when the app is not in focus?

Answers


There are Inactive colors for this purpose.

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;

The Buttons have Hover and Pressed color sets too.


Need Your Help

Very simple binding of an object list to a ListBox

c# wpf wpf-controls

Given the following, how do I have only the DeviceName property show up in the DeviceListBox?

select element with prototype

javascript prototypejs

how can I select the following element using prototype div#page_container h1 and after selecting it change its padding-top ? Thank you

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.