首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >应用MahApps.Metro黑暗主题

应用MahApps.Metro黑暗主题
EN

Stack Overflow用户
提问于 2014-01-26 11:46:36
回答 1查看 17K关注 0票数 12

我对WPF比较陌生,我正在尝试将Windows主题应用到我的整个应用程序中。

我在我的Apps.xaml中使用了下面的内容,我可以正确地看到主题。

代码语言:javascript
复制
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

现在我想把主题改成黑暗。我知道我总能用,

ThemeManager.ChangeTheme()

但是,我认为应该有一种方法可以对应用程序的所有窗口有效地使用XAML。

我的问题:能指点我如何做到这一点而无需在源代码中使用ThemeManager吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-26 12:27:41

尝试使用BaseDark而不是BaseLight。尝试更改这一行:

代码语言:javascript
复制
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />

对此:

代码语言:javascript
复制
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />

这对我起了作用。使用MahApps BaseDark和BaseLight口音的应用程序屏幕截图:

BaseDark

BaseLight

票数 21
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21362935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档