Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP: styling the window buttons does not work on the close button

in a Windows 10 UWP we can style the title bar and window buttons (windows chrome). However this does not work on the close button when use hover or click onto them. Take the following snippet:

        Color PrimaryColor = Color.FromArgb( 0xFF, 0xFF, 0x00, 0x00 );
        Color ContrastColor = Color.FromArgb( 0xFF, 0x00, 0x00, 0x00 );
        Color SemiColor = Color.FromArgb( 0xFF, 0x7F, 0x00, 0x00 );

        ApplicationView AppView = ApplicationView.GetForCurrentView();

        AppView.TitleBar.ButtonInactiveBackgroundColor = ContrastColor;
        AppView.TitleBar.ButtonInactiveForegroundColor = PrimaryColor;
        AppView.TitleBar.ButtonBackgroundColor = ContrastColor;
        AppView.TitleBar.ButtonForegroundColor = PrimaryColor;

        AppView.TitleBar.ButtonHoverBackgroundColor = PrimaryColor;
        AppView.TitleBar.ButtonHoverForegroundColor = ContrastColor;

        AppView.TitleBar.ButtonPressedBackgroundColor = SemiColor;
        AppView.TitleBar.ButtonPressedForegroundColor = ContrastColor;

This should make all buttons black with a red foreground (the icon). When pressed a half red background should be used.
It works flawlessly for the min and max buttons - on the close button only the background and foreground (and the inactive version of it) display correctly. The hover and pressed states fall back to the default windows values.

Refer to the following image. The close button has another red (the default one) and the default white foreground when hovered over.

TitleBar buttons _

Does anyone have any idea what the problem is? Is it a bug or am I doing something wrong?

Thanks in advance!
-Simon

like image 264
Simon Mattes Avatar asked May 14 '15 18:05

Simon Mattes


1 Answers

You're doing it right, this is just the way it is right now. Keep in mind that they are still changing title bar styling based on user feedback, so it's possible this could change. If you want more control over certain aspects of the title bar, consider building a fully customized title bar using the CoreApplicationViewTitleBar.ExtendViewIntoTitleBar property. Not sure if it will solve this specific problem, though.

like image 183
stenobot Avatar answered Oct 07 '22 14:10

stenobot