Hello,
I would like to help with GridViewComboBoxColumn behavior. I have almost solved how to automatically show popup on click. Next, I want to end edit after selecting some item from combo box, similar to standard DataGridView behavior. I have done this so far:
private void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
{
// automatic combo expanding
if (radGridView1.IsInEditMode)
return;
var cell = sender as GridComboBoxCellElement;
if (cell == null)
return;
radGridView1.BeginEdit();
var editor = cell.Editor as RadDropDownListEditor;
if (editor == null)
return;
var el = editor.EditorElement as RadDropDownListEditorElement;
if (el == null)
return;
el.SelectedIndexChanged += El_SelectedIndexChanged;
el.ShowPopup();
}
private void El_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
var el = sender as RadDropDownListEditorElement;
if(el == null)
return;
radGridView1.EndEdit();
el.SelectedIndexChanged -= El_SelectedIndexChanged;
}
I attach SelectedIndexChanged event handler to RadDropDownListEditorElement before showing popup. In this handler, I call EndEdit first and then detach the handler. This works ok except for one case, when user selects the same item, in this case SelectedIndexChanged is not fired, because SelectedIndex hasn't changed:
I tried the same with other events like PopupClosed, but when I cal EndEdit in these events, selected value is not commited. Is it possible to do this somehow? I have attached test project, TelerikTestReal in solution. Thanks.