Color Picker custom color

2 posts, 0 answers
  1. Andrew Hawkins
    Andrew Hawkins avatar
    1 posts
    Member since:
    Apr 2009

    Posted 18 Nov 2009 Link to this post


    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?

  2. Bobi
    Bobi avatar
    513 posts

    Posted 18 Nov 2009 Link to this post

    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:
    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.

    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.
Back to Top