-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
Ra
dColorDialog.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
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
Thanks for your answer!
Work like I wanted!
Ben
Kind regards,
Stefan
the Telerik team
It's seem that the GridColorPickerElement is not existing anymore.
How can I do that now?
GridColorPickerEditor editor = e.ActiveEditor
as
GridColorPickerEditor;
if
(editor !=
null
)
{
GridColorPickerElement element = editor.EditorElement
as
GridColorPickerElement;
RadColorDialog dialog = element.ColorDialog;
dialog.ColorDialogForm.ShowProfessionalColors =
false
;
}
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
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();
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/.
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
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;
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/.
Works like a charm.
Thanks
Vic