dotMorten / WinUIEx

WinUI Extensions
https://dotmorten.github.io/WinUIEx
MIT License
572 stars 36 forks source link

Can't change TransparentTintBackdrop.TintColor at runtime #149

Closed frozax closed 5 months ago

frozax commented 7 months ago

Hello,

I'm trying to change the TintColor of a TransparentTintBackdrop at runtime, using something similar to:

(SystemBackdrop as TransparentTintBackdrop).TintColor = myColor;

It's not working, the color is not changed.

I also tried to change the whole backdrop, with something like:

SystemBackdrop = new TransparentTintBackdrop(myColor);

In this case, it does indeed change the backdrop. However, there is a visible ugly glitch (as if there was one frame without backdrop at all). I also tried to precompute the backdrops to avoid the new, but I still get the glitch.

I'm using version 2.3.3.

frozax commented 7 months ago

If I change the method CreateBrush in TransparentTintBackdrop to this:

        protected override Windows.UI.Composition.CompositionBrush CreateBrush(Windows.UI.Composition.Compositor compositor)
        {
            brush = WindowManager.Compositor.CreateColorBrush(TintColor);
            return brush;
        }

It works. Hope this helps.

dotMorten commented 5 months ago

@frozax Thank you! Your fix was spot on.

dotMorten commented 4 months ago

Just a heads up that this fix is in the latest 2.3.4 release