Skip to main content

PaletteRepository.RegisterPalette(Palette) Method

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

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.1.dll

NuGet Package: DevExpress.Charts

Declaration

public void RegisterPalette(
    Palette palette
)

Parameters

Name Type Description
palette Palette

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:

// 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";
See Also