Is there a way to tell if the user has selected a Light or Dark theme?
Thanks!
Is there a way to tell if the user has selected a Light or Dark theme?
Thanks!
If you intend to detect the theme in code, then here is a solution -
var backColor = Resources["PhoneBackgroundColor"];
if (backColor.ToString() == "#FF000000")
// Dark theme selected => do something
else
// Light theme selected => do something
HTH, indyfromoz
There is a property to test for this, rather that comparing the actual resource color.
Visibility v = (Visibility)Resources["PhoneLightThemeVisibility"];
if (v == System.Windows.Visibility.Visible)
{
// Is light theme
}
else
{
// Is dark theme
}