Changing The MahApps Metro Theme

和自甴很熟 提交于 2019-12-04 18:15:23

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/15917657/changing-the-mahapps-metro-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!