Change your Text Color or Background as per light or dark Theme in Windows Silverlight Development XAML


Boolean isDark = false;

var bgtheme = Application.Current.Resources[“PhoneBackgroundColor”].ToString();
if (bgtheme == “#FF000000”)
isDark = true;
else
isDark = false;

if (isDark)
{
TextContent.Foreground = new SolidColorBrush(Colors.White);
ContentPanel.Background = “your dark theme background”;

}
else
{
TextContent.Foreground = new SolidColorBrush(Colors.Black);
ContentPanel.Background = “your light theme background”;
}

Leave a Reply

Your email address will not be published.