Hi David,
Thank you for reporting this. This indeed is not working as expected. A possible solution here will be to manually handle this scenario. You can create a custom GridDataRowBehavior and override the ProcessKey method where you can move the current cell depending on the press arrow key.
public class CustomGridRowBehavior : GridDataRowBehavior
{
public override bool ProcessKey(KeyEventArgs keys)
{
if (keys.Control)
{
if (keys.KeyCode == Keys.Up)
{
var rowIndex = this.GridViewElement.CurrentCell.RowIndex;
var columnIndex = this.GridViewElement.CurrentCell.ColumnIndex;
int newRowIndex = rowIndex == 0 ? 0 : rowIndex - 1;
this.GridControl.CurrentRow = this.GridControl.Rows[newRowIndex];
this.GridControl.CurrentColumn = this.GridControl.Columns[columnIndex];
return true;
}
if (keys.KeyCode == Keys.Down)
{
var rowIndex = this.GridViewElement.CurrentCell.RowIndex;
var columnIndex = this.GridViewElement.CurrentCell.ColumnIndex;
int newRowIndex = rowIndex == this.GridControl.Rows.Count-1 ? this.GridControl.Rows.Count-1 : rowIndex + 1;
this.GridControl.CurrentRow = this.GridControl.Rows[newRowIndex];
this.GridControl.CurrentColumn = this.GridControl.Columns[columnIndex];
return true;
}
if (keys.KeyCode == Keys.Left)
{
var rowIndex = this.GridViewElement.CurrentCell.RowIndex;
var columnIndex = this.GridViewElement.CurrentCell.ColumnIndex;
int newColumnIndex = columnIndex == 0 ? 0 : columnIndex - 1;
this.GridControl.CurrentRow = this.GridControl.Rows[rowIndex];
this.GridControl.CurrentColumn = this.GridControl.Columns[newColumnIndex];
return true;
}
if (keys.KeyCode == Keys.Right)
{
var rowIndex = this.GridViewElement.CurrentCell.RowIndex;
var columnIndex = this.GridViewElement.CurrentCell.ColumnIndex;
int newColumnIndex = columnIndex == this.GridControl.Columns.Count-1 ? this.GridControl.Columns.Count-1 : columnIndex + 1;
this.GridControl.CurrentRow = this.GridControl.Rows[rowIndex];
this.GridControl.CurrentColumn = this.GridControl.Columns[newColumnIndex];
return true;
}
}
return base.ProcessKey(keys);
}
}
public RadForm1()
{
InitializeComponent();
//register the custom row behavior
BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior;
gridBehavior.UnregisterBehavior(typeof(GridDataRowBehavior));
gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridRowBehavior());
BaseGridBehavior gridBehavior2 = radGridView2.GridBehavior as BaseGridBehavior;
gridBehavior2.UnregisterBehavior(typeof(GridDataRowBehavior));
gridBehavior2.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridRowBehavior());
}
Regards,
Dinko | Tech Support Engineer
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.