如何在Windows Phone 8.1中使用ThemeResources更改主题?

时间:2014-06-15 09:22:02

标签: c# xaml windows-phone-8 windows-runtime windows-phone

我在app.xaml中定义了主题。当用户在设置中更改其手机主题时,它适用于LightDark

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Dark">
                <SolidColorBrush x:Key="MyAppBackground" Color="Black"/>
                <SolidColorBrush x:Key="MyAppAccentColor" Color="White"/>
                <SolidColorBrush x:Key="MyAppTextColor" Color="Red"/>
            </ResourceDictionary>
            <ResourceDictionary x:Key="Light">
                <SolidColorBrush x:Key="MyAppBackground" Color="White"/>
                <SolidColorBrush x:Key="MyAppAccentColor" Color="Black"/>
                <SolidColorBrush x:Key="MyAppTextColor" Color="Yellow"/>
            </ResourceDictionary>
            <ResourceDictionary x:Key="CustomTheme1">
                <SolidColorBrush x:Key="MyAppBackground" Color="Blue"/>
                <SolidColorBrush x:Key="MyAppAccentColor" Color="Green"/>
                <SolidColorBrush x:Key="MyAppTextColor" Color="White"/>
            </ResourceDictionary>
        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>

但我希望能够在应用中将主题更改为CustomTheme1。在我可以设置的xaml中      RequestedTheme="Light"

但它没有我的自定义主题。

这是一款Windows Phone 8.1应用程序

1 个答案:

答案 0 :(得分:0)

目前,您只能设置Light或Dark主题。除了自定义浅色和深色主题外,没有选项可以在RequestedTheme中添加自定义主题。