UWP AcrylicBrush HostBackdrop cause Color Changes when Window loses focus

192 Views Asked by At

I have Grid whose Background will be altered according to the color of album art at the run time. And I change the Background using the following code:

        return new AcrylicBrush()
        {
            BackgroundSource = AcrylicBackgroundSource.HostBackdrop,
            TintOpacity = 0.75,
            TintColor = Color.FromArgb(bgra[3], bgra[2], bgra[1], bgra[0])
        };

However, the HostBackdrop is causing the trouble for me. As you can see from the images I post below, the background turns white it loses focus. It is normal when the window has focus. And when I change the HostBackdrop to Backdrop, the color no longer changes. But I do want to use HostBackdrop.

How can I achieve that? Thanks in advance!

Unfocused

Focused

1

There are 1 best solutions below

3
On BEST ANSWER

Currently AcrylicBrush only works when the window gets focus, you can view the document with a description of this

If you need to set the color of the AcrylicBrush when the window loses focus, you can use the FallbackColor property.

Best regards.