Application.RequestedTheme Application.RequestedTheme Application.RequestedTheme Application.RequestedTheme Property


Gets or sets a value that determines the light-dark preference for the overall theme of an app.

public : ApplicationTheme RequestedTheme { get; set; }
ApplicationTheme RequestedTheme();

void RequestedTheme(ApplicationTheme requestedtheme);
public ApplicationTheme RequestedTheme { get; set; }
Public ReadWrite Property RequestedTheme As ApplicationTheme
<application RequestedTheme="applicationThemeMemberName" .../>
Property Value

A value of the enumeration. The initial value is the default theme set by the user in Windows settings.


There are two built in themes: "Light" and "Dark". By default your app runs using the theme set by the user in Windows settings (Settings > Personalization > Colors > Choose your default app mode). You can set the app's RequestedTheme property to override the user default and 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.

You can change specific theme values at run-time after Application.RequestedTheme is applied, if you use the FrameworkElement.RequestedTheme property and sets values on specific elements in the UI.

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 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} markup extension 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.

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. This file is available in the (Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP<SDK version>\Generic folder from a Windows Software Development Kit (SDK) installation.

Notes for Windows 8

(This section applies only to apps for Windows 8, not UWP apps for Windows 10.)

By default your app runs using the "Dark" theme (in the themeresources.xaml file, the key name for the "Dark" resources is "Default").

On Windows, setting RequestedTheme to ElementTheme.Default will always result in "Dark" being the theme. On Windows Phone, using the ElementTheme.Default value will result in a query for the system theme, as set by the user.

See Also