This is a migrated thread and some comments may be shown as answers.

Color Picker custom color

1 Answer 119 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Andrew Hawkins
Top achievements
Rank 1
Andrew Hawkins asked on 18 Nov 2009, 09:18 AM
Hello,

I am using ColorPicker control to create user interface for selecting color. From a user point of view the ColorPicker component provides very easy and useful inteface but there is no possibility for the user to select color which is different form the predefined set of colors.
Is it possible to switch interface so it can allow user to enter color with RGB values or with # format?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 18 Nov 2009, 01:41 PM
Hello Andrew Hawkins,

Please find attached a sample project that shows how to add a new color items to RadColorPicker dynamically at run time.
In order to test the example follow the steps:
1.Enter some valid color in the TextBox like for example:
                                  #FF475A7A
2.Press the "Add new Color to the ColorPicker control" button.
3.If you open the ColorPicker you will see that the newly entered color is added to the ColorPicker collection.
4.Add  other values in the text box and you will see the effect.

Note: This is only a sample project so I missed some validation of the entered text. In a real scenario you have to check for a valid entered color.
In order to customize the appearance of RadColorPicker you can also Hide some of the palettes like for example:
this.colorPicker.HeaderPaletteVisibility = Visibility.Collapsed;// This is optional
this.colorPicker.StandadrPaletteVisibility = Visibility.Collapsed;// This is optional
As to the implementation I used the build in method for color conversion:

             ColorPaletteBase.HexStringToColor(string hexColor);

I hope that this will help you.

Regards,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ColorPicker
Asked by
Andrew Hawkins
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Share this question
or