How to change the UWP app standard minimize/maximize/close toolbar background?

DotNET Fan 46 Reputation points
2023-01-19T08:41:15.15+00:00

The UWP app is using the dark theme and it is set like in the c# code.

Current.RequestedTheme =ApplicationTheme.Dark;

if we change to lighter windows themes from the personalization/themes in windows 10/11 , somehow it changes the UWP app minimize/maximize/close toolbar background to light.

User's image

How can i change that to the same Dark theme background so that it can match the UWP app dark theme? Microsoft UWP experts pls advise.

Universal Windows Platform (UWP)
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
559 questions
No comments
{count} votes

Accepted answer
  1. Roy Li - MSFT 26,476 Reputation points Microsoft Employee
    2023-01-19T09:22:03.05+00:00

    Hello,

    Welcome to Microsoft Q&A!

    You could customize the titlebar in UWP apps include the color for System caption buttons. What you need to do is just get the ApplicationView.GetForCurrentView().TitleBar object first and change some of the background properties.

    Here is the sample code that you could refer to:

    
      public MainPage()
            {
                this.InitializeComponent();
    
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
    
                titleBar.ButtonBackgroundColor = Colors.Yellow;
                titleBar.ButtonHoverBackgroundColor = Colors.Red;
                titleBar.ButtonPressedBackgroundColor = Colors.Blue;
                titleBar.ButtonInactiveBackgroundColor = Colors.Gray;
            }
    
    

    You could get more information here: Title bar customization

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our [documentation][2] to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful