Window.ThemeMode Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the Fluent theme mode of the window.
public:
property System::Windows::ThemeMode ThemeMode { System::Windows::ThemeMode get(); void set(System::Windows::ThemeMode value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.ThemeModeConverter))]
[System.Diagnostics.CodeAnalysis.Experimental("WPF0001")]
public System.Windows.ThemeMode ThemeMode { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.ThemeModeConverter))>]
[<System.Diagnostics.CodeAnalysis.Experimental("WPF0001")>]
member this.ThemeMode : System.Windows.ThemeMode with get, set
Public Property ThemeMode As ThemeMode
Property Value
- Attributes
Remarks
Setting this property controls if Fluent theme is loaded in Light, Dark or System mode.
It also controls the application of backdrop and darkmode on window.
The four values for the ThemeMode enum are :
None - No Fluent theme is loaded. However, if ThemeMode is not None, then the window will appear as defined in ThemeMode.
System - Fluent theme is loaded based on the system theme.
Light - Fluent theme is loaded in Light mode.
Dark - Fluent theme is loaded in Dark mode.
These values are predefined in ThemeMode struct The default value is None.
ThemeMode and System.Windows.Resources are designed to be in sync with each other.
Syncing is done in order to avoid UI inconsistencies, where the window is in dark mode but the controls within are in light mode or vice versa.
Setting this property loads the Fluent theme dictionaries in the window resources.
So, if you set this property, it is preferrable to not include Fluent theme dictionaries in the window resources manually. If you do, the Fluent theme dictionaries added in the window resources will take precedence over the ones added by setting this property.
This property is experimental and may be removed in future versions.