0

Hi i have this problem with my applicationbar. When i change the theme to light the icons turns to black, can I prevent this or can I change the backgroundcolor to something else when light theme is on.

Now i have a purple background all the time so either change the icons or background.

Any ideas for this?

4

1 回答 1

1

对于检测深色或浅色主题颜色,您可以使用

bool DarkThemeUsed ()
{ 
     return Visibility.Visible ==   (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"];
}

bool LightThemeUsed() 
{
     return Visibility.Visible == (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"];
}

来源是developer.nokia.com:在这个网站上,你有很多关于 windows phone 小问题的想法和解决方案:D

您可以在启动应用程序时(在 App.xaml.cs 上)测试您的手机是使用暗色还是亮色:

private void Application_Launching(object sender, LaunchingEventArgs e)
{
    DetectUserTheme();
}

private void DetectUserTheme()
{
    if(LightThemeUsed())
    {
        // Adapt your icons, background for the light theme.
        return;
    }

    // Adapt your icons, background for the dark theme. 
}

您还可以使用用户定义的颜色强调:

 Color currentAccentColorHex = 
        (Color)Application.Current.Resources["PhoneAccentColor"];

你可以在你的应用程序中使用它来处理一些彩色文本或元素......

于 2013-06-07T08:24:40.887 回答