Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

theme in windows phone(light or dark) using c#

How do I know what the theme is selected in the settings (light or dark)? I want to use a conditional statement such as

if (darkTheme) {..}
else {..}
like image 691
Yaroslav Shabanov Avatar asked Aug 13 '13 12:08

Yaroslav Shabanov


1 Answers

You want to find your response in the official MSDN page for Theme on Windows Phone.

In the part "Determining Theme Background" that indicate :

// 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";
}

Also, in this page, you've a part on the "theme accent color". To recover the two main colors defined by the user ( background and accent color).

like image 50
Doc Roms Avatar answered Sep 28 '22 04:09

Doc Roms