microsoft / TemplateStudio

Template Studio accelerates the creation of new WinUI 3, WPF, and UWP apps using a wizard-based experience.
Other
2.65k stars 459 forks source link

Fix always-enabled dark mode shadow bug #4685

Open RGarrido03 opened 1 year ago

RGarrido03 commented 1 year ago

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 its DwmSetWindowAttribute 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