wpf-devexpress-dot-xpf-dot-core-dot-win10palette.md
A palette that can get the Windows accent color and app mode, and update the theme each time a user changes these Windows settings.
Namespace : DevExpress.Xpf.Core
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
public sealed class Win10Palette :
ThemePalette
Public NotInheritable Class Win10Palette
Inherits ThemePalette
Pass a Win10Palette object as a parameter to a Theme.CreateTheme method to generate a theme based on a Win10Dark or Win10Light DevExpress theme. The palette allows you to get the following Windows theme settings, listen to their changes, and apply them to your application:
Refer to the following Microsoft help topic for more information: Change colors in Windows
The Win10Palette works with Windows 10 and higher.
When creating a Win10Palette instance, you can use the following constructor parameters to manage palette settings:
accentColorSpecifies a palette accent color. If the palette cannot find a Windows accent color, the application accent color is set to #FF0078D7.listenAccentColorChanges
Specifies whether to get or ignore Windows accent color changes.
If true, the Win10Palette performs the following actions when a user changes an accent color in Windows:
If false, the Win10Palette ignores Windows accent color changes.
appModeSpecifies an app mode. If the palette cannot find a Windows app mode, the application app mode is set to Light.listenAppModeChanges
Specifies whether to get or ignore Windows app mode changes.
If true, the Win10Palette performs the following actions when a user changes an accent color in Windows:
If false, the Win10Palette ignores Windows app mode changes.
Tip
You can use the Theme.CachePaletteThemes property to cache the current palette theme assembly. The cache reduces load times in future application runs.
The code sample below creates a theme with colors based on Windows settings and applies it to an application on startup:
protected override void OnStartup(StartupEventArgs e) {
var palette = new Win10Palette(true);
var theme = Theme.CreateTheme(palette);
Theme.RegisterTheme(theme);
ApplicationThemeHelper.ApplicationThemeName = theme.Name;
base.OnStartup(e);
}
Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
Dim palette = New Win10Palette(true)
Dim theme = Theme.CreateTheme(palette)
Theme.RegisterTheme(theme)
ApplicationThemeHelper.ApplicationThemeName = theme.Name
MyBase.OnStartup(e)
End Sub
Object ThemePaletteBase ThemePalette Win10Palette
See Also