PopupColorEdit Class
Represents a color editor displayed within a dropdown window.
Namespace: DevExpress.Xpf.Editors
Assembly: DevExpress.Xpf.Core.v18.2.dll
Declaration
Related API Members
The following members return PopupColorEdit objects:
Remarks
The PopupColorEdit editor allows an end-user to choose the required color using the Color Picker interface.
Its features include:
- 20 Preset Palettes - Apex, Civic, Grayscale, Office, etc.
- Recent Colors Palette - includes custom colors which can be added via the More Colors dialog.
- Unlimited Number of Custom Color Palettes - by default, the editor displays three color palettes: Theme Colors, Gradient Theme Colors and Standard Colors. 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. Use the static ColorPalette.CreateGradientPalette method to create a palette with gradient colors. To display a custom palette within the editor, add it to the PopupColorEdit.Palettes collection.
- Configurable Palette Layout - you can manually specify the number of color columns using the PopupColorEdit.ColumnCount property. Alternatively, the number of columns is automatically calculated.
- Customizable Default Color - you can specify the default color, which is applied by clicking the Default Color Button. To do this, use the ColorEdit.DefaultColor property.
- Optional Empty Color - to allow an end-user to select an empty color (ColorEdit.EmptyColor), set the PopupColorEdit.ShowNoColorButton property to true. This shows the No Color Button within the editor.
- Localizable UI
Example
This example shows how to create custom palettes and display them within the PopupColorEdit control.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/popupcoloredit-create-custom-palettes-e2357.
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports DevExpress.Xpf.Editors
Namespace DXEditors_PopupColorEdit
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
' Removes the 'Standard Colors' palette.
popupColorEdit1.Palettes.Remove(popupColorEdit1.Palettes("Standard Colors"))
' Adds a custom gradient palette.
popupColorEdit1.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)
popupColorEdit1.Palettes.Add(palette)
End Sub
End Class
End Namespace
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the PopupColorEdit class.
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.