In this case, we have GridViewTextBoxColumn and GridViewComboBoxColumn after it. We want to trigger the edit on the second column at the moment it is navigated with the key arrow navigation. To do that BeginEdit() method is called. However, manually calling this method will trigger key events on the editor inside the GridViewComboBoxColumn which will bubble to the parent and move the current cell to the next column (skipped the GridViewComboBoxColumn )
This behavior could be workaround by delaying the execution of the BeginEdit() method.
public class CustomGridBehavior : BaseGridBehavior
{
Timer timer = new Timer();
public override bool ProcessKey(KeyEventArgs keys)
{
var result = base.ProcessKey(keys);
if((keys.KeyCode == Keys.Left || keys.KeyCode == Keys.Right) && this.GridControl.CurrentColumn is GridViewComboBoxColumn)
{
timer.Interval = 100;
timer.Tick += Timer_Tick;
timer.Start();
}
return true;
}
private void Timer_Tick(object sender, EventArgs e)
{
timer.Stop();
this.GridControl.BeginEdit();
}
}
this.radGridView1.GridBehavior = new CustomGridBehavior();