Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing The MahApps Metro Theme

I know that the MahApps metro theme comes with "themes" (colour sets), but I don't know how to change them from the default settings in my WPF application.

I have followed the beginners tutorial at MahApps.Metro Documentation (including adding the resource libraries at the top of the page), but it makes no mention about changing the theme.

The component/Styles/Colours.xaml file has the comment "from the cosmopolitan theme pack", which may be a helpful clue to someone better versed in WPF design than me.

I'm talking about an app-wide theme change, not an individual control.

like image 465
gbmhunter Avatar asked Apr 10 '13 05:04

gbmhunter


People also ask

How to change accent and theme in mahapps Metro?

MahApps.Metro has a ThemeManager to change accent and theme at code behind. You can easily changing accent or theme with a two liner.

How do I change the theme of a metrowindow?

It can be done in 1 line, like so: With MahApps.Metro you can have a different theme for a MetroWindow. The main window or any other MetroWindow will keep the specified theme in the App.xaml or window xaml. You can do this with the ThemeManager, like so:

How to change the accent and theme of the app?

The fastest way is to specify the accent and theme via the App.xaml. MahApps.Metro has a ThemeManager to change accent and theme at code behind. You can easily changing accent or theme with a two liner. With MahApps.Metro you can have a different accent and theme for a MetroWindow.

What is the final naming convention of mahapps?

Final naming convention is: MahApps. and the resource type which is one of Colors., Brushes., Sizes., Font., Fonts., Storyboard., Styles., Templates. and the target control for Templates and Styles (e.g. Button., Slider., Window., ...)


1 Answers

If you want to change the default colour scheme, just change which colour resource file is loaded.

from Blue:

    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />

to Red:

    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" />

You can also change programatically (once you've loaded every colour resource file) using ThemeManager.ChangeTheme().

like image 61
Rich Avatar answered Nov 16 '22 00:11

Rich