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

ListBoxSelectionMode = MultiExtended and Del

My problem is that if I set ListBoxSelectionMode = MultiExtended on my GridControl and I select a cell in a row, pressing Del cleares the whole row. However, pasting text from the clipboard worx well, t.i. only the currently selected cell gets modified. If no current cell available (I select the whole row by clicking on the row header), only then pasting overwrites each cell in the row. Workaround?

5 Replies

AD Administrator Syncfusion Team June 21, 2005 08:12 AM UTC

Exactly what is the behavior you want to see that you do not see now?


AD Administrator Syncfusion Team June 21, 2005 08:22 AM UTC

If you do not want to clear rows, then you can handle the ClearingCells event and set e.Handled = true, doing nothing in this case.
private void gridControl1_ClearingCells(object sender, GridClearingCellsEventArgs e)
{
	if(e.RangeList.ActiveRange.IsRows)
		e.Handled = true;
}

            


AD Administrator Syncfusion Team June 21, 2005 08:43 AM UTC

I simply want the following if I press Del: If no currentcell exists, then delete each cell in the selection. (This is, when I select a row clicking on the row header.) If there is a currentcell, then only the contents of that cell get deleted.


AD Administrator Syncfusion Team June 21, 2005 09:12 AM UTC

OK, now I can see your point: there''s always a currentcell: if I select the row clicking on the row header, then the header cell will be the currentcell. So, I use the ClearingCell event.


AD Administrator Syncfusion Team June 21, 2005 10:19 AM UTC

I think this event handler will do what you described.
private void gridControl1_ClearingCells(object sender, GridClearingCellsEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.ColIndex > 0 && !cc.IsEditing)
	{
		this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue = null;
		e.Handled = true;
		e.Result = true;
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon