Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: DarkTintOpacity breaks mica backdrop on dark mode #91

Closed
yaira2 opened this issue Dec 8, 2022 · 4 comments
Closed

Bug: DarkTintOpacity breaks mica backdrop on dark mode #91

yaira2 opened this issue Dec 8, 2022 · 4 comments

Comments

@yaira2
Copy link

yaira2 commented Dec 8, 2022

Description

Modifying the DarkTintOpacity causes mica to be applied incorrectly on dark mode.

Steps to repro

  1. Create a MicaSystemBackdrop in xaml and change the DarkTintOpacity value. This issue is only present when you set a custom DarkTintOpacity.
<winuiex:WindowEx.Backdrop>
	<winuiex:MicaSystemBackdrop DarkTintOpacity="0.8"/>
</winuiex:WindowEx.Backdrop>

Screenshot

image

Version

This issue was introduced in v2.0

@dotMorten
Copy link
Owner

dotMorten commented Dec 8, 2022

Something SUPER funky is going on here.
If I step through this method:

mica.TintOpacity = (float)(isDark ? DarkTintOpacity : LightTintOpacity);

it's not an issue. As I'm stepping through it, I notice the default Mica values are changing mid-debugging.
If I delay the call of this method a few 100 ms, the issue goes away too (but that is error prone and also looks terrible).

It's called from the ActualThemeChanged event:

m_backdrop.UpdateController(currentController, BackdropConfiguration.Theme);

It's like WinAppSDK doesn't like some properties to get changed right after a theme change, but considering you'd likely want different backdrop settings for light and dark mode, this is the time to do it.

@ChewWorker @codendone @BenJKuhn Any thoughts on this? Are we not supposed to update backdrop values in the theme changed event?

@dotMorten
Copy link
Owner

WinAppSDK bug. Logged: microsoft/microsoft-ui-xaml#10212

@dotMorten
Copy link
Owner

Closing now that backdrop APIs are in Windows App SDK and deprecated in WinUIEx

@yaira2
Copy link
Author

yaira2 commented Apr 14, 2023

@dotMorten thank you for your work on this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants