ColorPalette.CreateGradientPalette(String, ColorCollection) Method

Returns a palette filled with gradient colors from specified base colors.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v20.1.dll


public static ColorPalette CreateGradientPalette(
    string name,
    ColorCollection source
Public Shared Function CreateGradientPalette(
    name As String,
    source As ColorCollection
) As ColorPalette


Name Type Description
name String

A String value that specifies the palette name. This value is assigned to the ColorPalette.Name property.

source ColorCollection

The collection of base colors.


Type Description

A ColorPalette descendant that represents a palette with gradient colors.


The CreateGradientPalette method creates a new palette with the specified name and generates gradient colors for each base color in source.


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()
            ' 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)
        End Sub
    End Class
End Namespace
See Also