Mica BackDropMaterial not updating when RequestedTheme changes
See original GitHub issueDescribe the bug
The Mica material is not toggling between light and dark theme when RequestedTheme
of the Page to which it is applied changes.
Steps to reproduce the bug
- Apply Mica to Page (
muxc:BackdropMaterial.ApplyToRootOrPageBackground="True"
) - Change the
RequestedTheme
Property of Page from Light to Dark
Expected behavior Background changes according to the theme
Screenshots
Version Info
NuGet package version: 2.7.0-prerelease.210827001
Windows app type:
UWP | Win32 |
---|---|
Yes |
Windows version | Saw the problem? |
---|---|
Insider Build (22454.1000) | Yes |
May 2021 Update (19043) | |
October 2020 Update (19042) | |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | Yes |
Xbox | |
Surface Hub | |
IoT |
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Mica Backdrop effects not working properly on Windows 11 ...
I was checking out the WPF UI and found that the Mica and Acrylic backdrop are not correctly picking up the light or...
Read more >Mica material not showing up on secondary window
If I click on show second window, It pops up, but the background is in my system-accent-color, not the Mica material.
Read more >Application.RequestedTheme Property (Windows.UI.Xaml)
You can change specific theme values at run-time after Application.RequestedTheme is applied, if you use the FrameworkElement.RequestedTheme property and sets ...
Read more >WinUI 3 | XAML Brewer, by Diederik Krols
Mica. The app uses Mica material as its background. When you look at the overly complex way of applying it to your WinUI...
Read more >Welcome to HandyControl
In HandyControl, almost all native controls have a base style that is implemented by default (that is, when a style is defined, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had similar issue when I set muxc:BackdropMaterial.ApplyToRootOrPageBackground=“True” for control that then became Window.Content. The problem was that Mica infrastructure subscribed to the Window.Content.ActualThemeChanged event for soon-to-be-replaced Window.Content, and then lost the ability to feel theme changes.
Either do not change Window.Content, or set muxc:BackdropMaterial.ApplyToRootOrPageBackground=“True” in code after completing such change.
@eugenegff is likely correct. Unfortunately we don’t have a way to do RequestedTheme for a XamlRoot so you set it on the content but then if the content changes or if you set it on a child of the thing that is the root, we don’t know about it.
So you need to set it on Window.Current.Content.RequestedTheme and then don’t change Window.Current.Content.