c# – 应用MahApps.Metro黑色主题
发布时间:2020-12-15 17:38:27 所属栏目:百科 来源:网络整理
导读:我对 WPF比较新,我正在尝试将 Windows Metro Dark主题应用于我的整个应用程序. 我在我的Apps.xaml中使用了以下内容,我可以正确地看到Windows Metro Light主题. Application.Resources ResourceDictionary ResourceDictionary.MergedDictionaries ResourceDic
我对
WPF比较新,我正在尝试将
Windows Metro Dark主题应用于我的整个应用程序.
我在我的Apps.xaml中使用了以下内容,我可以正确地看到Windows Metro Light主题. <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> 现在我想将主题改为Dark.我明白我可以随时使用,
但是我相信应该有一个方法来做到这一点XAML有效的应用程序的所有窗口. 我的问题:有没有人可以指出如何在源代码中不使用ThemeManager? 解决方法
尝试使用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来 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |