Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
2,967 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I'm trying to create an app setting in c++ uwp and it has three radio buttons: "Light" "Dark" and "System Default". How do get the system default (light, dark, etc.) when I initialize the app? Thank you.
Save "System Theme" to app data and on app initialization, do this:
auto DefaultTheme = ref new Windows::UI::ViewManagement::UISettings();
auto uiTheme = DefaultTheme->GetColorValue(Windows::UI::ViewManagement::UIColorType::Background).ToString();
if (uiTheme == "#FF000000")
{
App::Current->RequestedTheme = ApplicationTheme::Dark;
}
else if (uiTheme == "#FFFFFFFF")
{
App::Current->RequestedTheme = ApplicationTheme::Light;
}