使用c#在Windows手机(浅色或深色)中的主题

Yar*_*nov 5 c# silverlight colors windows-phone-7

我如何知道在设置(亮或暗)中选择的主题是什么?我想使用条件语句,如

if (darkTheme) {..}
else {..}
Run Code Online (Sandbox Code Playgroud)

Doc*_*oms 6

您想在Windows Phone 的Theme 的官方MSDN页面中找到您的回复.

在"确定主题背景"部分中指出:

// Determine the visibility of the dark background.
Visibility darkBackgroundVisibility = 
    (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"];

// Write the theme background value.
if (darkBackgroundVisibility == Visibility.Visible)
{
    textBlock1.Text = "background = dark";
}
else
{
    textBlock1.Text = "background = light";
}
Run Code Online (Sandbox Code Playgroud)

此外,在这个页面中,你参与了"主题强调色".恢复用户定义的两种主要颜色(背景和强调颜色).


Ant*_*ell 3

if( (Visibility)App.Current.Resources["PhoneDarkThemeVisibility"] )
...
else
...
Run Code Online (Sandbox Code Playgroud)