You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If Window.ExtendsContentIntoTitleBar == true, WinUI 3 appears to set the DWMWA_USE_IMMERSIVE_DARK_MODE attribute to true. This results in the window gaining a darker shadow. This is good if your app is using dark mode, however, it sets the attribute even in light mode.
Steps to reproduce the bug
Make a window that sets Window.ExtendsContentIntoTitleBar to true. With your system in light mode, observe that the shadow is darker than other Windows apps that are in light mode. You can also toggle immersive dark mode with DwmSetWindowAttribute yourself and see how this is impacting the shadow.
Expected behavior
DWMWA_USE_IMMERSIVE_DARK_MODE should be set to true only when the app is in dark mode. The expected behavior is light mode gets a small window shadow, and dark mode gets a big window shadow.
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.2.5: 1.2.230313.1
Windows version
Windows 11 (22H2): Build 22621
Additional context
This issue is similar to (and sort of the opposite of) #8376. In that issue, which assumes you are not using Window.ExtendsContentIntoTitleBar, immersive dark mode is never set, even though it needs to be in dark mode. This issue is the opposite: as long as Window.ExtendsContentIntoTitleBar is on, immersive dark mode is always turned on, even when it shouldn’t be (when the app is in light mode). This issue is similar to #7131 but deals specifically with the shadow and immersive dark mode.
There is a workaround. I would suggest avoiding Window.ExtendsContentIntoTitleBar and using AppWindowTitleBar.ExtendsContentIntoTitleBar instead. However, you can use DwmSetWindowAttribute(WindowNative.GetWindowHandle(this), DWMWA_USE_IMMERSIVE_DARK_MODE, ...) to turn off immersive dark mode when the app is in light mode, which fixes the shadow.
The text was updated successfully, but these errors were encountered:
Describe the bug
If
Window.ExtendsContentIntoTitleBar == true
, WinUI 3 appears to set the DWMWA_USE_IMMERSIVE_DARK_MODE attribute to true. This results in the window gaining a darker shadow. This is good if your app is using dark mode, however, it sets the attribute even in light mode.Steps to reproduce the bug
Make a window that sets Window.ExtendsContentIntoTitleBar to true. With your system in light mode, observe that the shadow is darker than other Windows apps that are in light mode. You can also toggle immersive dark mode with DwmSetWindowAttribute yourself and see how this is impacting the shadow.
Expected behavior
DWMWA_USE_IMMERSIVE_DARK_MODE should be set to true only when the app is in dark mode. The expected behavior is light mode gets a small window shadow, and dark mode gets a big window shadow.
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.2.5: 1.2.230313.1
Windows version
Windows 11 (22H2): Build 22621
Additional context
This issue is similar to (and sort of the opposite of) #8376. In that issue, which assumes you are not using
Window.ExtendsContentIntoTitleBar
, immersive dark mode is never set, even though it needs to be in dark mode. This issue is the opposite: as long asWindow.ExtendsContentIntoTitleBar
is on, immersive dark mode is always turned on, even when it shouldn’t be (when the app is in light mode). This issue is similar to #7131 but deals specifically with the shadow and immersive dark mode.There is a workaround. I would suggest avoiding
Window.ExtendsContentIntoTitleBar
and usingAppWindowTitleBar.ExtendsContentIntoTitleBar
instead. However, you can useDwmSetWindowAttribute(WindowNative.GetWindowHandle(this), DWMWA_USE_IMMERSIVE_DARK_MODE, ...)
to turn off immersive dark mode when the app is in light mode, which fixes the shadow.The text was updated successfully, but these errors were encountered: