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

Checkbox on mousedown only

I was comparing the checkbox functionality on a standard listview and it checks the box on the mouse down and not the combination of the mouse down and mouse up. Is there anyway to make the grid controls checkbox behave the same way.

1 Reply

AD Administrator Syncfusion Team June 4, 2004 10:45 AM UTC

The standard windows forms checkbox changes the check on mouseup. If you want change it on MouseDown, then you can try the event handler below. But there maybe undesired consequences of doing so. For example, if you mousedown on a checkbox and drag to select a range of cells, the checkbox changes. (ListView does not support this I assume.)
private void gridControl1_GridControlMouseDown(object sender, CancelMouseEventArgs e)
	Point pt = new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y);
	int row, col;
	if(this.gridControl1.PointToRowCol(pt, out row, out col, -1))
		if(this.gridControl1[row, col].CellType == "CheckBox")
			if(this.gridControl1[row, col].Text == this.gridControl1[row, col].CheckBoxOptions.CheckedValue)
				this.gridControl1[row, col].Text = this.gridControl1[row, col].CheckBoxOptions.UncheckedValue;
				this.gridControl1[row, col].Text = this.gridControl1[row, col].CheckBoxOptions.CheckedValue;
	        this.gridControl1.CurrentCell.MoveTo(row, col);
			e.Cancel = true;

Live Chat Icon For mobile
Up arrow icon