Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the title bar color in a Windows Universal app?

I am looking to change the colors of the title bar to better suit my app similar to what has been done in the Mail app. How would I go about doing that?

like image 342
Rohit Rajendran Avatar asked Jan 07 '23 20:01

Rohit Rajendran


2 Answers

The background and foreground colors of parts of the TitleBar can be changed as follows.

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

Be aware that these changes happen after the app has displayed so the user will see the colors change.

like image 95
thomasforth Avatar answered Jan 30 '23 01:01

thomasforth


You can customize the background of the title bar by doing the following:

var appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
var titleBar = appView.TitleBar;
titleBar.BackgroundColor = Colors.Black;

You can change the other colors of the title bar like the foreground color or the button colors by changing the color in the other properties.

like image 20
Rohit Rajendran Avatar answered Jan 30 '23 00:01

Rohit Rajendran