FlexGrid, by default, allows to select a continuous batch of cells using mouse or keyboard and entire row or column by clicking the corresponding header. However, the default behavior can be changed to allow selection in units of cell, row, column etc. by using SelectionMode property of the FlexGrid class. The property accepts values from the GridSelectionMode enumeration. The following table gives a quick snapshot of how selection looks like in each of these modes.
Value | Description | Snapshot |
---|---|---|
None | Disables selection of cells in FlexGrid control. | |
Cell | Allows selection of single cell at a time. | |
CellRange | Allows selection of continuous batch of cells using mouse or keyboard. | |
Column | Allows selection of single column at a time. | |
ColumnRange | Allows selection of multiple contiguous columns at a time. | |
Row | Allows selection of single row at a time. | |
RowRange | Allows selection of multiple contiguous rows at a time. | |
MultiRange | Allows selection of collection of ranges. | |
ListBox | Allows selection of non-contiguous rows by ctrl+clicking. | |
MultiColumns | Allows selection of non-contiguous columns by ctrl+clicking. |
The following code shows how to set selection for a cell range using the SelectionMode property. This example uses the sample created in the Quick Start topic.