question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MahApps integration theme switch not working properly

See original GitHub issue

Hello, 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:

Senza titolo

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:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Gerardo-Sistacommented, Jul 27, 2019

Please check yourself. I prepared a very small app reproducing the issue: MaterialDesignXAML.zip

OUTPUT Before click: image

After click: image

0reactions
Gerardo-Sistacommented, Aug 6, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mahapps.Metro changing theme of single control
Is there any way to change theme (light/dark) on a per control basis in mahapps metro? My problem is, that I have a...
Read more >
Thememanager
Thememanager. MahApps.Metro has a ThemeManager class that lets you change the theme using code-behind. It can be done in 1 line, like so:...
Read more >
Usage
Usage. This guide will introduce you to the themes that MahApps.Metro has and how to create your own. All of MahApps.Metro 's themes...
Read more >
5 Steps to Getting Started With Material Design In XAML
In this tutorial, we saw how easy it is to integrate Material Design in XAML into a WPF application. I have been working...
Read more >
Metro UI or Modern UI Application in WPF using MahApps
Initially Microsoft used term Metro UI later they used Modern UI for describing the design. You can easily build this design in your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found