Back to Devexpress

PaletteRepository.RegisterPalette(Palette) Method

corelibraries-devexpress-dot-xtracharts-dot-paletterepository-dot-registerpalette-x28-devexpress-dot-xtracharts-dot-palette-x29.md

latest2.3 KB
Original Source

PaletteRepository.RegisterPalette(Palette) Method

Performs a check and adds the specified palette to the repository.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public void RegisterPalette(
    Palette palette
)
vb
Public Sub RegisterPalette(
    palette As Palette
)

Parameters

NameTypeDescription
palettePalette

A Palette object to register.

|

Remarks

The RegisterPalette method checks a palette’s name before it is added to the repository. A palette with the same name is replaced. If the palette name exists in the list of predefined palette names, an exception is raised.

Example

The following example shows how to create a palette, register the palette, and apply it to a chart:

csharp
// Create a palette.
Palette palette = new Palette("Custom Palette");
palette.Add(Color.Yellow);
palette.Add(Color.Red);
palette.Add(Color.Green);
// Register the palette.
chartControl1.PaletteRepository.RegisterPalette(palette);
// Assign the palette to the chart.
chartControl1.PaletteName = "Custom Palette";
vb
' Create a palette.
Dim palette As Palette = New Palette("Custom Palette")
palette.Add(Color.Yellow)
palette.Add(Color.Red)
palette.Add(Color.Green)
' Register the palette.
chartControl1.PaletteRepository.RegisterPalette(palette)
' Assign the palette to the chart.
chartControl1.PaletteName = "Custom Palette"

See Also

PaletteRepository Class

PaletteRepository Members

DevExpress.XtraCharts Namespace