如何在UWP中获取Windows系统主题? 浅/深
var DefaultTheme = new Windows.UI.ViewManagement.UISettings();
WindowsThemeText.Text =DefaultTheme.UIElementColor(Windows.UI.ViewManagement.UIElementType.PageBackground).ToString();
我已经尝试过,但它并没有显示主题....
答案 0 :(得分:0)
var DefaultTheme = new Windows.UI.ViewManagement.UISettings();
var uiTheme = DefaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString();
if(uiTheme == "#FF000000")
{
WindowsThemeText.Text = "Dark";
}
else if(uiTheme == "#FFFFFFFF")
{
WindowsThemeText.Text = "Light";
}
/*
else
{
WindowsThemeText.Text = "Some new Updated theme found";
}
*/