Skip to main content
All docs
V24.1

Win10Palette(Nullable<Color>, Boolean) Constructor

Initializes a new instance of the Win10Palette class with specified settings.

Namespace: DevExpress.Xpf.Core

Assembly: DevExpress.Xpf.Core.v24.1.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public Win10Palette(
    Color? accentColor = null,
    bool listenAccentColorChanges = true
)

Optional Parameters

Name Type Default Description
accentColor Nullable<Color> null

null to get the Windows accent color; otherwise, the accent color.

listenAccentColorChanges Boolean True

true to create and apply a new palette to Win10 themes when a user changes the Windows accent color; otherwise, false.

Remarks

Pass a Win10Palette instance as a parameter to any Theme.CreateTheme method to generate a theme with a Windows accent color.

If the listenAccentColorChanges constructor parameter is true, the palette generates a new theme each time a user changes the Windows accent color setting.

The Win10Palette works with Windows 10 and higher. If the palette cannot find a Windows accent color, the parameter is set to #FF0078D7.

Tip

You can use the Theme.CachePaletteThemes property to cache the current palette theme assembly. The cache reduces load times in future application runs.

Examples

The following code sample generates a new theme (based on the Win10Light) that gets the Windows accent color, and applies the theme on application startup:

protected override void OnStartup(StartupEventArgs e) {
    var palette = new Win10Palette();
    var theme = Theme.CreateTheme(palette, Theme.Win10Light);
    Theme.RegisterTheme(theme);
    ApplicationThemeHelper.ApplicationThemeName = theme.Name;
    base.OnStartup(e);
}

The following code sample generates a new theme (based on the Win10Light) with the ffffb900 accent color and applies the theme on application startup:

protected override void OnStartup(StartupEventArgs e) {
    var palette = new Win10Palette((Color)ColorConverter.ConvertFromString("#ffffb900"), false);
    var theme = Theme.CreateTheme(palette, Theme.Win10Light);
    Theme.RegisterTheme(theme);
    ApplicationThemeHelper.ApplicationThemeName = theme.Name;
    base.OnStartup(e);
}
See Also