我对WPF比较陌生,我正在尝试将Windows主题应用到我的整个应用程序中。
我在我的Apps.xaml中使用了下面的内容,我可以正确地看到主题。
<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吗?
发布于 2014-01-26 12:27:41
尝试使用BaseDark而不是BaseLight。尝试更改这一行:
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />对此:
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />这对我起了作用。使用MahApps BaseDark和BaseLight口音的应用程序屏幕截图:
BaseDark

BaseLight

https://stackoverflow.com/questions/21362935
复制相似问题