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
close icon

WrapCellBehaviour destinguishing between tab/enter and arrows

I would like my grid to wrap rows when at the end of a row if the user presses tab or enter, but if I set my grids WrapCellBehaviour to WrapRow it also wraps if I use the left/right arrow keys. Is there a way to wrap rows for tab and enter but not for the arrow keys? Thanks, Sue

3 Replies

AD Administrator Syncfusion Team August 31, 2005 10:14 PM UTC

You can try handling CurrentCellKeyDown and ignore the right arrow there if you are on the last cell.
private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
	if(e.KeyCode == Keys.Right && this.gridControl1.CurrentCell.ColIndex == this.gridControl1.ColCount)
	{
		e.Handled = true;
	}
}


CV Catinat Velmourougan December 19, 2005 06:37 AM UTC

hi, If I am the last column and the user presses right arrow key,I dont want it to go the first column.How to prevent this? Should I use the above code or is there a property? regards, catinat


AD Administrator Syncfusion Team December 19, 2005 07:32 AM UTC

Hi Catinat, For a GridControl if the WrapCellBehavior is set to WrapRow then the currentCell moves from rows to rows with tab or right key when at the end of the column. If the WrapCellBehavior is set to None which, is by default then the movement of the currentcell is only within the row for the GridControl. this.gridControl1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.None; Let me know if you need any more details. Regards, Stanley

Loader.
Live Chat Icon For mobile
Up arrow icon