Fix always-enabled dark mode shadow bug #4685
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR checklist
Quick summary of changes
This PR adds a fix for the shadow bug, where the dark theme one was applied all the time, even when using the light theme (check the issue section for more details).
It uses the
dwmapi
DLL and itsDwmSetWindowAttribute
method.However, the shadow change isn't seamless (i.e., the transition is instant, as opposed to the smooth fade regarding the color scheme).
Which issue does this PR relate to?
Big shout-out to @BreeceW and their issue (microsoft/microsoft-ui-xaml#8377), because they found a workaround for this bug, which results in this PR. It's sad that this isn't fixed in WinUI itself, though.
The microsoft/microsoft-ui-xaml#7131 issue also references this problem, although the posted workaround doesn't solve this issue.
Applies to the following platforms:
Anything that requires particular review or attention?
No
Do all automated tests pass?
Yes
Have automated tests been added for new features?
N/A
If you've changed the UI:
If you've included a new template:
Have you raised issues for any needed follow-on work?
N/A
Have docs been updated?
No
If breaking changes or different ways of doing things have been introduced, have they been communicated widely?
N/A