Skip to main content
A newer version of this page is available. .

ColorEdit.Palettes Property

Gets or sets the collection of palettes. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v19.2.dll

Declaration

public PaletteCollection Palettes { get; set; }

Property Value

Type Description
PaletteCollection

A PaletteCollection object that represents a collection of palettes.

Remarks

The ColorEdit stores its palettes within the Palettes collection. This collection provides methods that allow you to add new palettes and remove existing ones. Individual palettes are represented by ColorPalette descendants, and can be accessed using indexed notation or the name (ColorPalette.Name).

By default, the editor displays three color palettes: Theme Colors, Gradient Theme Colors and Standard Colors. The Recent Colors palette is automatically created when an end user selects a custom color from the More Colors dialog.

ColorEdit_Palettes

You can replace default palettes or add any number of custom color palettes. To create a color palette, create a new instance of the CustomPalette class, and define the colors using the ColorPalette.Colors property. To create a palette with gradient colors, use the static ColorPalette.CreateGradientPalette method.

Example

This example shows how to create custom palettes and display them within a ColorEdit control.

Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Windows.Controls
Imports System.Windows.Media
Imports DevExpress.Xpf.Editors

Namespace DXEditors_ColorEdit
    ''' <summary>
    ''' Interaction logic for MainWindow.xaml
    ''' </summary>
    Partial Public Class MainWindow
        Inherits Window
        Public Sub New()
            InitializeComponent()
            ' Removes the 'Standard Colors' palette.
            colorEdit1.Palettes.Remove(colorEdit1.Palettes("Standard Colors"))
            ' Adds a custom gradient palette.
            colorEdit1.Palettes.Add(CustomPalette.CreateGradientPalette("Apex Colors", PredefinedColorCollections.Apex))
            ' Adds a new palette with three custom RGB colors.
            Dim customColors As List(Of Color) = New List(Of Color)
            customColors.Add(Color.FromRgb(150, 18, 30))
            customColors.Add(Color.FromRgb(20, 40, 20))
            customColors.Add(Color.FromRgb(88, 73, 29))
            Dim palette As CustomPalette = New CustomPalette("Custom RGB Colors", customColors)
            colorEdit1.Palettes.Add(palette)
        End Sub
    End Class
End Namespace

The following code snippets (auto-collected from DevExpress Examples) contain references to the Palettes property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also