I have a grid derived from GridControl. Under certain circumstance, I want selection of a cell to actually select the entire row and sometimes multiple rows.
How would I handle this? If I handle the SelectionChanging event can I then modify the range that''s passed in? What is the proper way to set the selection to one or more entire rows?
ADAdministrator Syncfusion Team October 4, 2004 07:51 AM
>> If I handle the SelectionChanging event can I then modify the range that''''s passed in?
Yes, you can modify e.Range. But make sure you test it for not being empty. This event is raised when selections are cleared with e.Range = empty.
ADAdministrator Syncfusion Team October 4, 2004 10:03 AM
I''m getting some unusual behavior.
When I select a cell, the SelectionChanging event gets called with the Empty but not with the cell selection. Row selection (which is also enabled) works fine. The SelectionChanging gets called with empty to remove the previous selection and then it gets called again with the new selection.
AllowSelection is set to Row | Cell
ADAdministrator Syncfusion Team October 4, 2004 10:56 AM
By selecting a cell, do you mean making it the current cell? If so, the default behavior is to not include the currentcell as part of the selections. (Being the currentcell and being selected are not treated as the same thing.)
If you set ExcelLikeCurrentCell, then the current cell will be treated as part of the selections. You may also want to turn on ExcelLikeSelectionFrame in this case also.
If you do not want this look, then you could try handling CurrentCellMoved, and if the current cell is not part of the selections, then explicilty add it to the selections.