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

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 04:23 AM

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.
Live Chat Icon For mobile
Up arrow icon