Custom Color Dialog For ColorColumn

7 posts, 1 answers
  1. Ben B
    Ben B avatar
    4 posts
    Member since:
    Apr 2012

    Posted 20 Apr 2012 Link to this post

    Dear Friends,

    -First, I would Like to know if it is possible to use a Custom Color Dialog when selecting(changing) color from a ColorColumn?
    (I can do it for other stuff in my Application but I don't know how in a GridView)

    What I Mean by Custom is to be able to Choose Only From the Web Color like that:
    RadColorDialog.ColorDialogForm.ShowBasicColors = False
    RadColorDialog.ColorDialogForm.ShowSystemColors = False
    RadColorDialog.ColorDialogForm.ShowProfessionalColors = False
    RadColorDialog.ColorDialogForm.ShowHEXColorValue = False
    RadColorDialog.ColorDialogForm.AllowColorPickFromScreen = False
    RadColorDialog.ColorDialogForm.ShowCustomColors = False



    -If it's Possible, can you guide me on which Event of the GridView I should do It !

    Thank you!

    Ben
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 21 Apr 2012 Link to this post

    Hello Benoit,

    Thank you for writing.

    In order to access the color dialog form, you need to subscribe to the CellEditorInitialized event of RadGridView, from where you can access its GridColorPickerEditor > GridColorPickerEditorElement > ColorDialog:
    Private Sub radGridView1_CellEditorInitialized(sender As Object, e As GridViewCellEventArgs) Handles RadGridView1.CellEditorInitialized
        Dim editor As GridColorPickerEditor = TryCast(e.ActiveEditor, GridColorPickerEditor)
        If editor IsNot Nothing Then
            Dim element As GridColorPickerElement = TryCast(editor.EditorElement, GridColorPickerElement)
            Dim dialog As RadColorDialog = element.ColorDialog
            dialog.ColorDialogForm.ShowProfessionalColors = False
                    ''and so on
        End If
    End Sub

    I hope that you find this information useful. Let us know if you have any other questions.

    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. Ben B
    Ben B avatar
    4 posts
    Member since:
    Apr 2012

    Posted 22 Apr 2012 Link to this post

    Hi Stefan,

    Thanks for your answer!

    Work like I wanted!

    Ben
  4. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 24 Apr 2012 Link to this post

    I am glad that I could help. Do not hesitate to contact us if you have any other questions.

    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  5. Yanick
    Yanick avatar
    3 posts
    Member since:
    Dec 2018

    Posted 06 Dec 2018 Link to this post

    It's seem that the GridColorPickerElement  is not existing anymore.

    How can I do that now?


  6. Yanick
    Yanick avatar
    3 posts
    Member since:
    Dec 2018

    Posted 06 Dec 2018 in reply to Yanick Link to this post

    GridColorPickerEditor editor = e.ActiveEditor as GridColorPickerEditor;
               if (editor != null)
               {
                   GridColorPickerElement element = editor.EditorElement as GridColorPickerElement;
                   RadColorDialog dialog = element.ColorDialog;
                   dialog.ColorDialogForm.ShowProfessionalColors = false;
               }
  7. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3759 posts

    Posted 10 Dec 2018 Link to this post

    Hello, Yanick,    

    In version 2016.1.112 GridColorPickerElement was marked as obsolete and later it was removed:



    In the latest version you should use the RadColorPickerEditorElement:

    private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
        GridColorPickerEditor editor = e.ActiveEditor as GridColorPickerEditor;
        if (editor != null)
        {
            RadColorPickerEditorElement element = editor.EditorElement as RadColorPickerEditorElement;
            RadColorDialog dialog = element.ColorDialog;
            dialog.ColorDialogForm.ShowProfessionalColors = false;
        }
    }

    I hope this information helps. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top