Win10Palette Class
A Windows 10 theme palette. Win10Palette can get the Windows 10 accent color and update the theme each time a user changes this color.
Namespace: DevExpress.Xpf.Core
Assembly: DevExpress.Xpf.Core.v20.2.dll
NuGet Packages: DevExpress.WindowsDesktop.Wpf.Core, DevExpress.Wpf.Core
Declaration
Remarks
You can create a Windows10Light theme with Win10Palette. The Win10Palette constructor has two parameters: accentColor and listenAccentColorChanges.
Pass a Color value to the accentColor constructor parameter to specify the palette accent color or leave the parameter empty to use the Windows 10 accent color.
When the listenAccentColorChanges constructor parameter is true, the Win10Palette performs the following actions:
- Gets a new accent color when a user changes the Windows 10 accent color.
- Creates a new theme.
- Applies the theme to an application.
Set the listenAccentColorChanges constructor parameter to false to stop getting a new accent color when a user changes the Windows 10 accent color.
Note
The Win10Palette works only with the Windows 10 OS version. If the Win10Palette has not found the Windows accent color, the application accent color is set to #FF0078D7.
Example
The following code sample creates a new Win10Light theme with the Windows 10 accent color and applies the theme on application startup:
protected override void OnStartup(StartupEventArgs e)
{
var accentpalette = new Win10Palette();
var customtheme = Theme.CreateTheme(accentpalette, Theme.Win10Light);
Theme.RegisterTheme(customtheme);
ApplicationThemeHelper.ApplicationThemeName = customtheme.Name;
base.OnStartup(e);
}