Gets or sets a value that determines the light-dark preference for the overall theme of an app.
A value of the enumeration.
Windows Store apps support two built in themes: "Light" and "Dark". By default your app runs using the "Dark" theme (in the themeresources.xaml file, the key name for the "Dark" resources is "Default"). You can set the app's RequestedTheme property to specify which theme is used.
The theme can only be set when the app is started, not while it’s running. Attempting to set RequestedTheme while the app is running throws an exception (NotSupportedException for Microsoft .NET code). If you give the user an option to pick a theme that's part of app UI, you must save the setting in the app data and apply it when the app is restarted.
There is also a "HighContrast" theme that uses system values, but apps and app code use a different technique for switching the app to high contrast. The RequestedTheme property is ignored if the user is running in high contrast mode. See Supporting high contrast themes and XAML high contrast style sample.
Although the app can't switch the themes at run-time, the user can (starting with Windows 8.1). For example, a user might enable a high-contrast theme while your app is running, by using the Alt+Shift+PrtScn key shortcut. If this happens, the XAML resource system will recalculate the resource values for any ThemeResource usage. Theme-appropriate resources such as colors and brushes then use values appropriate for the current theme, even though it wasn't the app that requested that theme originally.
An app can change specific theme values at run-time after Application.RequestedTheme is applied, if it uses the FrameworkElement.RequestedTheme property and sets values on specific elements in the UI.
The resources that are theme-specific are typically defined in a separate resource dictionary in XAML. This resource dictionary comes from the ThemeDictionaries property of the primary ResourceDictionary that is used for control templates. The default system resource dictionary for theme-specific resources is named ThemeResources.xaml. Find this file under the path \include\winrt\xaml\design in your Windows Software Development Kit (SDK) for Windows 8 installation location.
Minimum supported client
Minimum supported server
|Windows Server 2012|
- XAML requested theme sample
- Supporting high-contrast themes
Build date: 12/10/2013