Basic Selection
RadVirtualGrid provides you with a selection functionality, which allows the user to select one or more items (rows or cells) from the data displayed by the control.
Row Selection
To select an item in RadVirtualGrid click in the rectangle area of the desired row. By default the user can select only one row (the entire row is selected).
Cell Selection
You can modify RadVirtualGrid to select single cell instead of entire row by setting its SelectionMode property to CellSelect:
this.radVirtualGrid1.SelectionMode = VirtualGridSelectionMode.CellSelect;
Me.radVirtualGrid1.SelectionMode = VirtualGridSelectionMode.CellSelect
After setting this property, to select a cell in RadVirtualGrid, click the desired cell.
Events
The following events will fire in case the selection is changed:
- SelectionChanging: fires before the selection is changed.
- SelectionChanged: fires after the selection is changed.
- CurrentCellChanging: fires before the current cell is changed.
- CurrentCellChanged: fires after the current cell is changed.
API
Using the Selection property of the VirtualGridElement you can perform various selection operations. Here are the most common methods which this property exposes:
- ClearSelection: clears all selected items.
- IsSelected: you can use the this method to check if particular cell is selected.
- RowContainsSelection: use this method to check if a particular row contains the selected cell.
- SelectAll: use this method to select all cells.
In addition, you can use the following properties to get the selected rows or cells:
CurrentRowIndex: gets the current row index.
CurrentColumnIndex: gets the current selected column index.
SelectedRegion: returns the first selected region.
SelectedRegions: returns all selected regions.