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

Custom Color Dialog For ColorColumn

11 Answers 215 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ben B
Top achievements
Rank 1
Ben B asked on 20 Apr 2012, 03:13 PM
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

11 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 21 Apr 2012, 03:16 PM
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 >>
0
Ben B
Top achievements
Rank 1
answered on 22 Apr 2012, 02:50 PM
Hi Stefan,

Thanks for your answer!

Work like I wanted!

Ben
0
Stefan
Telerik team
answered on 24 Apr 2012, 12:03 PM
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 >>
0
Yanick
Top achievements
Rank 1
answered on 07 Dec 2018, 02:21 AM

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

How can I do that now?


0
Yanick
Top achievements
Rank 1
answered on 07 Dec 2018, 02:27 AM
GridColorPickerEditor editor = e.ActiveEditor as GridColorPickerEditor;
           if (editor != null)
           {
               GridColorPickerElement element = editor.EditorElement as GridColorPickerElement;
               RadColorDialog dialog = element.ColorDialog;
               dialog.ColorDialogForm.ShowProfessionalColors = false;
           }
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Dec 2018, 12:12 PM
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.
0
Victor
Top achievements
Rank 2
answered on 19 Dec 2020, 10:33 AM

I have the same question but in this case for the RadColorBox. Is it possible to change the colordialog here as well? I only want to show webcolors :

 

Hope you can help

RadColorDialog MyDialog = new RadColorDialog();
            MyDialog.ColorDialogForm.ShowWebColors = true;
            MyDialog.ColorDialogForm.ShowBasicColors = false;
            MyDialog.ColorDialogForm.ShowSystemColors = false;
            MyDialog.ColorDialogForm.ShowProfessionalColors = false;
            MyDialog.ColorDialogForm.ShowHEXColorValue = false;
            MyDialog.ColorDialogForm.AllowColorPickFromScreen = false;
            MyDialog.ShowDialog();

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Dec 2020, 10:32 AM

Hello, Victor,   

The provided code snippet seems to be correct and it produces the following result on my end with the latest version R3 2020 SP1:

Here you have direct access to the ColorDialogForm and it is possible to control that only the web colors are displayed. Am I missing something? Is the desired requirement achieved?

If you need any further assistance please specify in details what is the exact goal that you are trying to achieved. Thus, we would be able to investigate the precise case and think about a suitable solution. Thank you in advance for your cooperation.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Victor
Top achievements
Rank 2
answered on 21 Dec 2020, 11:25 AM

Hi Dess,

 

Sorry that I have not been clear. The issue is not when calling the dialogbox directly. That works fine. 

But is this also possible when using the RadColorBox. Here you get the full dialog, but I only want the web-colors.

 

Kg

Vic

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Dec 2020, 02:33 PM
Hello, Victor,   

RadColorBox internally uses the RadColorDialog as well. The following code snippet demonstrates how to access the dialog in the RadColorBox and show only the web colors:
            RadColorBox colorBox = new RadColorBox();
            colorBox.Location = new Point(10, 10);
            this.Controls.Add(colorBox);
            RadColorDialog MyDialog = colorBox.ColorDialog;  
            MyDialog.ColorDialogForm.ShowWebColors = true;
            MyDialog.ColorDialogForm.ShowBasicColors = false;
            MyDialog.ColorDialogForm.ShowSystemColors = false;
            MyDialog.ColorDialogForm.ShowProfessionalColors = false;
            MyDialog.ColorDialogForm.ShowHEXColorValue = false;
            MyDialog.ColorDialogForm.AllowColorPickFromScreen = false;
Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Victor
Top achievements
Rank 2
answered on 21 Dec 2020, 03:04 PM

Works like a charm. 

Thanks

Vic

Tags
GridView
Asked by
Ben B
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Ben B
Top achievements
Rank 1
Yanick
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Victor
Top achievements
Rank 2
Share this question
or