Changing behaviour of Home and End keys

Is there a simpler/better way of changing the behaviour of the Home/End keys when not editing to move the current cell rather than entering edit mode, other than overridding the KeyPressed event? Thanks, Sue

1 Reply

AD Administrator Syncfusion Team February 14, 2005 09:23 AM UTC

There are no property settings that affect this. I think you could use the CurrentCellKeyDown event to handle this though.
private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
	if(e.KeyCode == Keys.Home)
	{
		this.gridControl1.CurrentCell.EndEdit();
		this.gridControl1.CurrentCell.MoveTo(1, 1, GridSetCurrentCellOptions.ScrollInView);
		e.Handled = true;
	}
	else if(e.KeyCode == Keys.End)
	{
		this.gridControl1.CurrentCell.EndEdit();
		this.gridControl1.CurrentCell.MoveTo(this.gridControl1.RowCount,
                this.gridControl1.ColCount, GridSetCurrentCellOptions.ScrollInView);;
		e.Handled = true;
	}
}

Loader.
Up arrow icon