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

MultiExtended and Enter edit mode

We are working on a project that would require full rows to be selected and use of ctrl and shift. This is easy through gridControl1.ListBoxSelectionMode = SelectionMode.MultiExtended; However, we also only want to enter edit mode only if the user clicks on a currently selected row''s cell. IE, the first click on a cell will select the entire row, the second click on the cell will make it editable. Currently we have the grid set up as gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.SetCurrent; Better option? What is the proper strategy for accomplishing this?

2 Replies

AD Administrator Syncfusion Team March 17, 2004 03:48 PM UTC

I think you can do this by: 1) Adding member to your form: GridRangeInfoList rangeList; 2) in FormLoad: this.grid.ActivateCurrentCellBehavior = GridCellActivateAction.None; rangeList = this.grid.Selections.GetSelectedRows(false, true).Clone(); 3) Handle the grid''s MouseUp eevnt and save the selections. private void grid_MouseUp(object sender, MouseEventArgs e) { rangeList = this.grid.Selections.GetSelectedRows(true, false).Clone(); } 4) handle the grid''s MouseDown and start editing if the cell is in the saved selections.
private void grid_MouseDown(object sender, MouseEventArgs e)
{
	int row, col;
	if(rangeList.Count > 0 && 
		this.grid.PointToRowCol(new Point(e.X, e.Y), out row, out col, -1))
	{
		if(rangeList.AnyRangeContains(GridRangeInfo.Cell(row, col)))
		{
			this.grid.CurrentCell.BeginEdit();
		}
	}
}	


AD Administrator Syncfusion Team March 18, 2004 05:26 PM UTC

As Always, Clay Your the Man!!! Works great!

Loader.
Up arrow icon