14

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.

gbmhunter
  • 1,747
  • 3
  • 23
  • 24

1 Answers1

21

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().

Rich
  • 715
  • 7
  • 19
  • 2
    Thanks! Also, I discovered the base theme (which determines most of the colour scheme, the file you mentioned just changes the accents/highlights) can be changed with /Accents/BaseLight.xml or BaseDark.xml. – gbmhunter Apr 15 '13 at 23:34
  • Where are these files at? I've loaded MahApps from the package manager and I can see the .dll file, but I can't find these xaml files to edit. – Bishop Jun 19 '13 at 14:01
  • 3
    I think they're just bundled inside the dll. The source is at: https://github.com/MahApps/MahApps.Metro/tree/master/MahApps.Metro/Styles/Accents – Rich Jun 20 '13 at 14:06
  • @Rich Please if I need to make subtle changes like this to the default MahApps styles, does it mean that I need to edit the corresponding MahApps' xaml file and then recompile the dll? – Damilola Olowookere Nov 19 '14 at 07:13
  • Uh, I would presume so. You could also use a custom style based on the MahApps style, e.g. – Rich Nov 19 '14 at 14:34
  • @Rich Can we add our own colour theme without having to recompile any dll? EDIT: nevermind, the answer is yes - I found the XAML files on GitHub and made my own resource dictionary and added that to the merged dictionaries. – erotavlas Dec 11 '14 at 20:48