microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

DefaultTitleBarShouldMatchAppModeTheme does not respect RequestedTheme

Open lolametro opened this issue 1 year ago • 1 comments

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).

lolametro avatar Jun 08 '24 10:06 lolametro

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.

github-actions[bot] avatar Jun 08 '24 10:06 github-actions[bot]

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

ghost1372 avatar Jul 03 '24 09:07 ghost1372

@ghost1372 I tested as well with v1.6-exp2, and it's not fixed for me.

lolametro avatar Jul 03 '24 15:07 lolametro

@hiteshkrmsft Please reopen the issue, as it is not fixed with v1.7-exp2. I can still reproduce it.

lolametro avatar Feb 01 '25 09:02 lolametro

@lolametro This issue was closed via a script mirroring state of the internal bug. Looking at the internal bug, this was resolved because this API has been removed and replaced with something a little different. The new API will be available in the next 1.7 release.

codendone avatar Feb 04 '25 04:02 codendone

The new AppWindow.AppWindowTitleBar.PreferredTheme property in 1.7 with a TitleBarTheme enum of Default, UseDefaultAppMode, Light, Dark resolves the issue 👌

lolametro avatar Feb 07 '25 16:02 lolametro