wpf-devexpress-dot-xpf-dot-core-944f6436.md
A WPF Theme palette.
Namespace : DevExpress.Xpf.Core
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
public class ThemePalette :
ThemePaletteBase
Public Class ThemePalette
Inherits ThemePaletteBase
Create a palette instance and use the SetColor method to set color values to palette colors. The code snippet below changes the SelectionBackground and Foreground palette colors:
var mypalette = new ThemePalette("CustomPalette");
mypalette.SetColor("SelectionBackground", Colors.Red);
mypalette.SetColor("Foreground", Colors.Black);
Dim mypalette = New ThemePalette("CustomPalette")
mypalette.SetColor(SelectionBackground, Colors.Red)
mypalette.SetColor(Foreground, Colors.Black)
To apply a dynamic palette to an application, you should create a new theme. This theme should be based on a Theme with a Palette. Specify the base theme and the dynamic palette name and use the CreateTheme method to create a new theme assembly.
var customtheme = Theme.CreateTheme(mypalette, Theme.Office2016ColorfulSE);
Dim customtheme = Theme.CreateTheme(mypalette, Theme.Office2016ColorfulSE)
Register the created theme and apply it to an application.
Theme.RegisterTheme(customtheme);
ApplicationThemeHelper.ApplicationThemeName = customtheme.Name;
Theme.RegisterTheme(customtheme)
ApplicationThemeHelper.ApplicationThemeName = customtheme.Name
You can cache the current palette theme’s assembly to reduce the theme loading time. The application uses the cached assemblies at the current and the following application runs.
Set the Theme.CachePaletteThemes to true to cache the current palette theme’s assembly. The following code sample enables the palette theme assemblies caching to a default directory and applies the Office2019Colorful theme with the RedWine predefined palette to the application:
Theme.CachePaletteThemes = true;
Theme.RegisterPredefinedPaletteThemes();
ApplicationThemeHelper.ApplicationThemeName = "RedWineOffice2019Colorful";
Theme.CachePaletteThemes = true
Theme.RegisterPredefinedPaletteThemes()
ApplicationThemeHelper.ApplicationThemeName = "RedWineOffice2019Colorful"
Use the Theme.PaletteThemeCacheDirectory property to specify the directory where the cached assemblies are stored. The default cache directory is %LocalAppData%\DevExpress\PaletteThemeCache. The following code sample changes the default cache directory:
Theme.PaletteThemeCacheDirectory = "C:\\DevExpress\\PaletteThemeCache";
Theme.PaletteThemeCacheDirectory = "C:\DevExpress\PaletteThemeCache"
To remove the directory with the cached assemblies, use the Theme.ClearPaletteThemeCache method:
Theme.ClearPaletteThemeCache();
Theme.ClearPaletteThemeCache()
Object ThemePaletteBase ThemePalette Win10Palette
See Also