I've noticed that Grid.Selection.SelectedRegions returns the dataset row number values whenever a paging-enabled virtual grid page changes. i.e the selection may be on a different page than the one on view.
I'm having problems generating elegant code for moving the regions from page to page so they select from the page of data that's on view, including cases where a full page of data has less rows than the original selection.
The help file isn't very explanatory,
radVirtualGrid1.VirtualGridElement.Selection.BeginSelection(3, 1, radVirtualGrid1.MasterViewInfo, true); radVirtualGrid1.VirtualGridElement.Selection.ExtendCurrentRegion(6, 3);
If I've several individual rows selected then how do I manipulate the grid.selection.selectedregions so that I can assign the whole set of regions? following is the code Im trying but Im having a real struggle understanding what Im doing.
01.
var selectionRegions = Grid.Selection.SelectedRegions;
02.
var offset = Math.Abs(e.NewIndex - Grid.PageIndex);
03.
var multiplier = e.NewIndex > Grid.PageIndex
04.
? PageSize * offset
05.
: -PageSize * offset;
06.
var newRegions = new List<
SelectionRegion
>();
07.
foreach (var region in selectionRegions)
08.
{
09.
var newRegion = new SelectionRegion(region.Top * multiplier, region.Left,
10.
region.Bottom * multiplier, region.Right, region.ViewInfo);
11.
newRegions.Add(newRegion);
12.
}
13.
Grid.Selection.SelectedRegions. <- and here is where everything goes horribly wrong :)