I need to use a color picker in WPF and thought I would give the color picker in this toolkit in a try. I have to be able to display a custom list of colors because they relate to colors in another application. The colors correspond to indexes in a custom pallet so I need to display these indexes as the color names in the picker.
As a quick test I added the following in the initialization of my form
```
myColorPicker.DisplayColorAndName = true;
myColorPicker.AvailableColors.Clear();
myColorPicker.AvailableColors.Add(new Xceed.Wpf.Toolkit.ColorItem(System.Windows.Media.Color.FromRgb(110, 110, 110), "Color 12"));
```
When the form is loaded I can confirm the color picker only has my one color. If I hover over the color swatch the tooltip shows "Color 12" but when I pick the color it shows the hex color value of "#FF6E6E6E" in the picker control. This was a bit disappointing.
Is this expected when using custom colors?
When using the default colors it seems to show the name in the control after the color is picked. Although picking Cyan, which has a tooltip of Cyan, displays Aqua in the control after it's picked. The same happens when you pick Magenta which ends up showing Fuchsia in the control.
Comments: ** Comment from web user: BoucherS **
Hi,
The AvailableColors from the ColorPicker are the ones from the class "System.Windows.Media.Colors".
https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k(System.Windows.Media.Colors);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.0);k(DevLang-csharp)&rd=true
In this class, the Description of "Magenta" and "Fuchsia" is the same : "Gets the system-defined color that has an ARGB value of #FFFF00FF."
Same thing for "Cyan" and "Aqua", where description says : "Gets the system-defined color that has an ARGB value of #FF00FFFF."
Currently, the property "ColorPicker.SelectedColor is of type "Color", which have no name. We check if this selected color is one of the Colors from the "System.Windows.Media.Colors". If yes, its name is displayed. If no, we do a color.ToString(), which result in a "hex value" display.
In v3.1, we will check the ColorItem.Name and if there is 1, we will display it, as you wish.
In the meantime, you can go in file Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs,
In method Color_SelectionChanged
and add :
```
if( !string.IsNullOrEmpty( colorItem.Name ) )
{
this.SelectedColorText = colorItem.Name;
}
```
just after the line :
```
SelectedColor = colorItem.Color;
```