Articles in this section
Category / Section

How to create custom palette using ColorPickerPalette?

2 mins read

Setting IsCustomTabVisible and SetCustomColors properties

Set IsCustomTabVisible=Visible to make the custom tab visible in ColorPickerPalette. Set SetCustomColors=True to add your own custom colors in the custom tab.

Create custom colors

Create a collection of custom colors that need to be displayed. Custom colors are the instance of CustomColor class.

Setting CustomColorsCollection property

Set the collection of custom colors to CustomColorsCollection property.

Customizing tab header

You can customize the custom tab header text by setting the property CustomHeaderText. You can collapse the header by setting the property CustomHeaderVisibility to Collapsed.

MainWindow.xaml

<sync:ColorPickerPalette Height="35" Width="170" x:Name="color"           
            StandardPanelVisibility="Collapsed"
            MoreColorOptionVisibility="Collapsed"
            ThemePanelVisibility="Collapsed"
            RecentlyUsedPanelVisibility="Collapsed"
            AutomaticColorVisibility="Collapsed"
            CustomHeaderText="My Custom"
            CustomHeaderVisibility="Visible"            
            IsCustomTabVisible="Visible"            
            SetCustomColors="True"/>

 

MainWindow.xaml.cs

public MainWindow()
        {
            InitializeComponent();            System.Collections.ObjectModel.ObservableCollection<Syncfusion.Windows.Tools.Controls.CustomColor> colors=new System.Collections.ObjectModel.ObservableCollection<Syncfusion.Windows.Tools.Controls.CustomColor>();
            colors.Add(new CustomColor() { Color = Colors.RosyBrown, ColorName = "My RosyBrown" });
            colors.Add(new CustomColor() { Color = Colors.YellowGreen, ColorName = "My YellowGreen" });
            colors.Add(new CustomColor() { Color = Colors.Violet, ColorName = "My Violet" });
            colors.Add(new CustomColor() { Color = Color.FromArgb(0xFF, 0x00, 0x00, 0x00), ColorName = "My Black" });
            colors.Add(new CustomColor() { Color = Colors.Red, ColorName = "My Red" });
            colors.Add(new CustomColor() { Color = Colors.Green, ColorName = "My Green" });
            colors.Add(new CustomColor() { Color = Colors.Thistle, ColorName = "My Thistle" });
            colors.Add(new CustomColor() { Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), ColorName = "My White" });
            colors.Add(new CustomColor() { Color = Colors.SeaGreen, ColorName = "My SeaGreen" });
            colors.Add(new CustomColor() { Color = Colors.AliceBlue, ColorName = "My AliceBlue" });
            colors.Add(new CustomColor() { Color = Colors.SlateBlue, ColorName = "My SlateBlue" });
            colors.Add(new CustomColor() { Color = Color.FromArgb(0x78, 0x00, 0x00, 0xFF), ColorName = "My Transparent Blue" });            
            color.CustomColorsCollection = colors;
        }

The above code example creates a custom palette in ColorPickerPalette as follows.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied