且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何判断用户是否选择了浅色或深色主题

更新时间:2023-01-27 17:26:35

有一个属性来测试这个,而不是比较实际的资源颜色.

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
}