1. Select the ColorBox's ellipses to open the Color Dialog
on load of its Color Dialog the Web & System tabs have selected colors by default
2. Select the Web tab
In the below for Web its Transparent
3. Select "OK"
the colour doesn't get updated in the ColorBox on Color Dialog close
Which is understandable as a colour change hasn't occurred only the tab has been changed
However, following the same scenario above.
If the user wanted to select Transparent, they would need to:
2. Select a different colour even though its selected on load by default
3. Select back on Transparent
4. Select OK in order to see the colour reflected in the ColorBox
This is not ideal for an end user.
Is there a way to have no selection by default in the Web & System tabs?
Hello, James,
Indeed, the selected color is changed when clicking both of the buttons. We can restrict the behavior and perform the logic only when the OK button is pressed. I have updated the previous code as follows:
private void colorForm_FormClosed(object sender, FormClosedEventArgs e)
{
RadColorDialogForm colorForm = this.radColorBox1.ColorDialog.ColorDialogForm as RadColorDialogForm;
if (colorForm.DialogResult == DialogResult.OK)
{
RadColorSelector selector = this.radColorBox1.ColorDialog.ColorDialogForm.RadColorSelector as RadColorSelector;
if (selector.ControlsHolderPageView.SelectedPage.Text == "Web")
{
Telerik.WinControls.UI.RadColorPicker.ColorListBox webColorList = selector.ControlsHolderPageView.Pages[2].Controls[0] as ColorListBox;
Color selectedColor = (Color)webColorList.SelectedItem.Value;
this.radColorBox1.Value = selectedColor;
}
}
}
I believe that it would fit your case.
Regards,
Dess | Tech Support Engineer, Principal
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,
Thanks for getting back to me.
The issue with the below is colorForm_FormClosed will execute when any of the below are selected
When ideally the desire is to only execute when "Ok" is selected
& also makes "Cancel" & "X" redundant
Hello, James,
Indeed, if you switch to the Web tab and leave the Transparent color selected, clicking the OK button wouldn't change the SelectedColor in RadColorBox. This is because actual selection changing wasn't performed. However, your detailed explanation sounds reasonable and the user experience can be improved.
I have also updated your Telerik points for reporting this.
Currently, the possible solution that I can suggest is to use the following approach:
public RadForm1()
{
InitializeComponent();
this.radColorBox1.Value = Color.Blue;
RadColorDialogForm colorForm = this.radColorBox1.ColorDialog.ColorDialogForm as RadColorDialogForm;
colorForm.FormClosed += colorForm_FormClosed;
}
private void colorForm_FormClosed(object sender, FormClosedEventArgs e)
{
RadColorSelector selector = this.radColorBox1.ColorDialog.ColorDialogForm.RadColorSelector as RadColorSelector;
if (selector.ControlsHolderPageView.SelectedPage.Text == "Web")
{
Telerik.WinControls.UI.RadColorPicker.ColorListBox webColorList = selector.ControlsHolderPageView.Pages[2].Controls[0] as ColorListBox;
Color selectedColor = (Color)webColorList.SelectedItem.Value;
this.radColorBox1.Value = selectedColor;
}
}
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.