incorrectly selecting a range of rows from the grid.

Some issues with selecting rows from the grid:

Shift+click incorrectly toggles the seletion of a row if there were previous rows selected by Ctrl+click, and the last one of those rows has be selected then de-selected using Ctrl+click.

1. Select some rows using Ctrl+click.
2. Deselect the final row in the range, also using Ctrl+click.
3. Shift+click to select a range of rows beyond the row deselected.
- The last ctrl-selected row (in the oposite direction from the shift-select) has it's state toggled.

Example of above steps:
1. ex: ctrl-select rows 3,4,7.
2. ex: ctrl-deselect row 7.
3. ex: hold Shift and click row 10, selecting rows 7-10.
- row 4 incorrectly changes from selected to unselected!?


...this unwanted behavior also works in the other direction, except that it selects a row that was previously unselected. Examples of several cases:
example A:
1. ctrl-select rows 3,4,7.
2. ctrl+deselect row 7.
3. shift-select from row 7-10.
- row 4 becomes unselected.

example B:
1. ctrl-select rows 3,4,7.
2. ctrl+deselect row 7.
3. shift-select from row 3-1.
- all rows 7-1 becomes selected (but 7,6,5 should not be).

example C:
1. ctrl-select rows 3,4,7.
2. ctrl+deselect row 3.
3. shift-select from row 7-10
- all rows 3-10 become selected (but 3 should not be).

example D:
1. ctrl-select rows 3,4,7.
2. ctrl+deselect row 3.
3. shift-select from row 3-1.
- row 3 becomes re-selected, 7 becomes unselected.

2 Replies

AD Administrator Syncfusion Team November 22, 2006 11:31 AM UTC

Hi Matthew,

You can handle the Model.SelectionChanging event and set e.Cancel = true to select the rows programatically. Here is a code snippet to show this.

private void gridControl1_SelectionChanging(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventArgs e)
{
if( IsShiftKeySelection )
{
e.Cancel = true;
GridControl grid = sender as GridControl;
IsShiftKeySelection =false;
grid.Model.Selections.Add(e.ClickRange);
}
}

Sample : http://www.syncfusion.com/Support/user/uploads/GC_SelectionTest_be25542.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team January 17, 2007 11:01 PM UTC

Thank you.

Loader.
Up arrow icon