Reputation: 658
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?
Upvotes: 4
Views: 7000
Reputation: 93
You can customize the buttons and title text by adding a extend view into the title bar. please find the code snippet for this.
private void ExtendViewOftitleBar()
{
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
ApplicationView view = ApplicationView.GetForCurrentView();
ApplicationViewTitleBar titleBar = view.TitleBar;
view.SuppressSystemOverlays = true;
titleBar.BackgroundColor = Windows.UI.Color.FromArgb(0, 0, 0, 0);
titleBar.ForegroundColor = Windows.UI.Color.FromArgb(0, 0, 0, 0);
titleBar.InactiveBackgroundColor = Windows.UI.Color.FromArgb(0, 0, 0, 0);
titleBar.InactiveForegroundColor = Windows.UI.Color.FromArgb(0, 0, 0, 0);
titleBar.ButtonBackgroundColor = Windows.UI.Color.FromArgb(0, 0, 0, 0);
titleBar.ButtonHoverBackgroundColor = Windows.UI.Color.FromArgb(0, 0, 0, 0);
titleBar.ButtonPressedBackgroundColor = Windows.UI.Color.FromArgb(0, 0, 0, 0);
titleBar.ButtonInactiveBackgroundColor = Windows.UI.Color.FromArgb(0, 0, 0, 0);
}
Upvotes: 0
Reputation: 675
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.
Upvotes: 8
Reputation: 658
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.
Upvotes: 2