We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

What event gives the color a user selects in ColorEdit cell?

I'll admit I'm a newbie when it comes to the intricacies of Syncfusion's grids, but I'm missing something in the event sequence.
Here's my simple experiment. My goal is to react when the user selects a color in a ColorEdit cell.

In a new WinForm, create a new GridControl. Edit it so that some cell (I've been picking on 1,1 for this experiment) has a cell type of ColorEdit.
Add a button to the form as well.
Add event callbacks for the button's click and for the grid's CurrentCellChanged. (I've also looked at the grid's StyleChanged, CellsChanged, QueryCellInfo, QueryCellModel, and BackColorChanged events, but they either never fire, or in the case of the queries, give me a recursive call error when I look at the internals of the cell within the event.)

My limited understanding is that CurrentCellChanged should fire when the user selects a color, and it does. But neither Text, FormattedText nor CellValue reflect the new value the user selected; nor does any field that I can look at in the debugger.

I let the code continue from there, set a breakpoint on the button's click callback, and use the debugger to check the values of the ColorEdit cell after clicking the button. Text, FormattedText and CellValue all reflect the new value.

I understand from this that I need to catch some event after CurrentCellChanged to get the new color, or look at some data I haven't looked at during the CurrentCellChanged event. What should I do?

Thanks for any help you can give!

2 Replies

AD Administrator Syncfusion Team May 14, 2009 03:03 AM UTC

It seems I (finally) found my own answer, when trying to deal with other combo boxes. Even when the combobox mode is set to Exclusive or Autocomplete, closing the drop down does not submit the edit to the underlying data store or complete editing. Once you complete editing, either the AcceptedChanges or EditingComplete events will show the new value. Since ColorEdit is a specialized ComboBox, it behaves in the same way.

If possible, I would still rather catch the event during CurrentCellChanged. I'm sure this must be easy, but if anyone wants to tell me what field to look at to see the user-entered text, that would give me all the information I need.

Thanks,

Scott


RC Rajadurai C Syncfusion Team May 15, 2009 01:09 PM UTC

Hi Scott,

Thanks for your interest in Syncfusion products.

After making change in cell, the changes cannot be saved in it until EndEdit() method is called. Please try the following code in CurrentCellChanged event in which ConfirmChanges() method forces the EndEdit() call thereby save the change and immediately reflect it.

void gridControl1_CurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
cc.ConfirmChanges();
Console.WriteLine(this.gridControl1[cc.RowIndex,cc.ColIndex ].Text);
}


Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon