If I select cell A1, and then select B1 using ctrl mouse click: 2 ranges are returned from the Grid.Selections.GetSelectedRanges method. Since these two ranges appear as 1, I would like to simply combine these ranges (A1:B1) or get the combined range from a SF method. How could I accomplish this?
ADAdministrator Syncfusion Team May 23, 2005 12:12 PM
The GridRangeInfo object does have helper methods like UnionRange that you can use to actually do the work, but there is nothing that I can think of in our library to help you decide whether you want to merge two ranges or not. You could handle the grid1.Model.SelectionChanged event. It has a e.Range with the new selection and an e.OldRanges with the old selections. You could iterate through the old selections of see if you can find a match for the new selection. If so, remove both the old selection and the new selection and replace it with a union of the 2. This would take a little coding, and you may have to check for recursive calls in SelectionChanged as the result of you adding a new selected range in the handler.