microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.15k stars 666 forks source link

DefaultTitleBarShouldMatchAppModeTheme does not respect RequestedTheme #9711

Open lolametro opened 3 weeks ago

lolametro commented 3 weeks ago

Describe the bug

AppWindow.DefaultTitleBarShouldMatchAppModeTheme does not respect the Application.RequestedTheme (or ((FrameworkElement)XamlRoot.Content).RequestedTheme) settings. The title bar color would then still not match the actual theme used in the app.

Steps to reproduce the bug

  1. Switch Windows app mode theme to "Dark"
  2. Set AppWindow.DefaultTitleBarShouldMatchAppModeTheme = true in the MainWindow
  3. Set RequestedTheme = ApplicationTheme.Light in the App ctor OR ((FrameworkElement)Content.XamlRoot.Content).RequestedTheme = ElementTheme.Light in the MainWindow
  4. Start the app
  5. See a dark title bar, while the app is in light mode

Expected behavior

See a light title bar, while the app is in light mode

Screenshots

image

NuGet package version

WinUI 3 - Windows App SDK 1.6 Experimental 1: 1.6.240531000-experimental1

Windows version

Windows 11 (22H2): Build 22621

Additional context

This means it is not possible to dynamically switch the title bar color, based on the selection of the user in the app. Most apps offer this kind of setting (even Microsoft apps like Paint), meaning the DefaultTitleBarShouldMatchAppModeTheme will not fit their needs and still require custom code. An additional annoyance is, that RequestedTheme cannot be set at runtime, only in the App ctor (#4474).

github-actions[bot] commented 3 weeks ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

ghost1372 commented 49 minutes ago

@codendone i tested with v1.6-exp2 and it seems that this issue fixed. so i think this issue can be closed