wpf modern-ui如何在代码背后选择一个主题?

时间:2015-09-13 19:27:49

标签: c# wpf xaml

在codeplex的mui中,app.xaml就像这样

<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.xaml" />
                <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/modernui.light.xaml"/>


            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

但每次运行程序时如何在代码后面选择FirstFloor.ModernUI;component/Assets/modernui.light.xaml"代替FirstFloor.ModernUI;component/Assets/modernui.light.xaml"

1 个答案:

答案 0 :(得分:1)

ModernUI源代码附带一个示例应用程序,向您展示如何完全按照您的要求执行操作。

该库有一个AppearanceManager类。设置当前实例ThemeSource属性:

AppearanceManager.Current.ThemeSource = AppearanceManager.LightThemeSource;