DashboardDesigner.CustomPalette Event
Allows you to substitute a dashboard palette used to paint dashboard item elements.
Namespace: DevExpress.DashboardWin
Assembly: DevExpress.Dashboard.v26.1.Win.dll
Declaration
Event Data
The CustomPalette event's data class is CustomPaletteEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Palette | Gets or sets a palette used to color dashboard item elements. |
| PaletteName | Gets the name of the selected palette. |
Remarks
DevExpress Dashboard uses a set of colors from predefined palettes. Use the DashboardPalette static read-only fields to get predefined dashboard palettes.
Handle the CustomPalette event to substitute a palette. Assign a DashboardPalette (built from DashboardPaletteItem objects that define a color, fill style, and line style) to CustomPaletteEventArgs.Palette. You can do this in two ways:
- Apply one palette everywhere.
The following code snippet applies a custom palette for
dashboardDesigner1, so the selected palette no longer matters:using DevExpress.DashboardCommon; using DevExpress.Drawing; using System.Collections.Generic; using System.Drawing; dashboardDesigner1.CustomPalette += DashboardDesigner1_CustomPalette; void DashboardDesigner1_CustomPalette(object sender, CustomPaletteEventArgs e) { // Create a new custom palette. List<DashboardPaletteItem> paletteItems = new List<DashboardPaletteItem>(); paletteItems.Add(new DashboardPaletteItem(Color.SteelBlue)); paletteItems.Add(new DashboardPaletteItem(Color.SeaGreen, DXHatchStyle.DiagonalCross)); paletteItems.Add(new DashboardPaletteItem(Color.IndianRed, DXHatchStyle.Sphere, DXDashStyle.Dash)); paletteItems.Add(new DashboardPaletteItem(Color.Goldenrod)); // The same palette is applied for every PaletteName. e.Palette = new DashboardPalette(paletteItems); }The image below displays the resulting palette:

- Change Colors for a specific palette.
Check CustomPaletteEventArgs.PaletteName and return custom colors only for that palette (for example, Bright). Other palettes are unchanged.
using DevExpress.DashboardCommon; using DevExpress.Drawing; using System.Collections.Generic; using System.Drawing; dashboardDesigner1.CustomPalette += DashboardDesigner1_CustomPalette; void DashboardDesigner1_CustomPalette(object sender, CustomPaletteEventArgs e) { // Substitute custom colors only for the built-in Bright palette. if (e.PaletteName == nameof(DashboardPalette.Bright)) { List<DashboardPaletteItem> paletteItems = new List<DashboardPaletteItem>(); paletteItems.Add(new DashboardPaletteItem(Color.SteelBlue)); paletteItems.Add(new DashboardPaletteItem(Color.SeaGreen, DXHatchStyle.DiagonalCross)); paletteItems.Add(new DashboardPaletteItem(Color.IndianRed, DXHatchStyle.Sphere, DXDashStyle.Dash)); paletteItems.Add(new DashboardPaletteItem(Color.Goldenrod)); e.Palette = new DashboardPalette(paletteItems); } }