更改 MahApps Metro 主题 [英] Changing The MahApps Metro Theme

查看:33
本文介绍了更改 MahApps Metro 主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 MahApps Metro 主题带有主题"(颜色集),但我不知道如何从我的 WPF 应用程序中的默认设置更改它们.

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.

我遵循了 MahApps.Metro 文档 上的初学者教程(包括在页面顶部),但没有提及更改主题.

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.

component/Styles/Colours.xaml 文件有来自国际化主题包"的注释,这对于比我更精通 WPF 设计的人来说可能是一个有用的线索.

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.

推荐答案

如果要更改默认配色方案,只需更改加载的颜色资源文件即可.

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

来自蓝色:

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

到红色:

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

您还可以使用 ThemeManager.ChangeTheme() 以编程方式进行更改(一旦您加载了每个颜色资源文件).

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

这篇关于更改 MahApps Metro 主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆