MahApps integration theme switch not working properly
See original GitHub issueHello, I have the standard App.XAML integration code, section “The App.XAML”: https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/MahApps.Metro-integration
I change the theme using this code:
public void SwitchTheme(bool IsDark, string SelectedPrimaryColor, string SelectedSecondaryColor) { IBaseTheme baseTheme = IsDark == true ? Theme.Dark : Theme.Light; Color pColor =(Color)ColorConverter.ConvertFromString(SelectedPrimaryColor); Color sColor = (Color)ColorConverter.ConvertFromString(SelectedSecondaryColor); ITheme theme = Theme.Create(baseTheme, pColor, sColor); ResourceDictionaryExtensions.SetTheme(Application.Current.Resources, theme); }
But theme doesn’t change properly, obtaining a partial switch like this:
Am I doing something wrong or is this a bug? In another app it works fine. Thank you in advance for any help!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Please check yourself. I prepared a very small app reproducing the issue: MaterialDesignXAML.zip
OUTPUT Before click:
After click:
Thank you very much for your attention and help. It seems it works now perfectly both in demo app and final app. Also, it’s more lightweight and straightforward code too: excellent improvement. I strongly suggest you to update the Wiki (as you did for issue #1325) since it seems was only a bad Wiki old code reference and not a true issue. Updating Wiki will prevent other users from encountering the same issue.
I’m closing this because the issue has been resolved. Thank you again.
Gerardo