# Selection

## Content



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](/componentone/api/maui/online-maui/dotnet-api/C1.Maui.Grid/C1.Maui.Grid.FlexGrid.SelectionMode.html) property of the [FlexGrid](/componentone/api/maui/online-maui/dotnet-api/C1.Maui.Grid/C1.Maui.Grid.FlexGrid.html) class. The property accepts values from the [GridSelectionMode](/componentone/api/maui/online-maui/dotnet-api/C1.Maui.Grid/C1.Maui.Grid.GridSelectionMode.html) 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. | ![disable cell selection](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/selection-none.png) |
| Cell | Allows selection of single cell at a time. | ![single cell selection](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/selection-cell.png) |
| CellRange | Allows selection of continuous batch of cells using mouse or keyboard. | ![cell range selection](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/selection-cellrange.png) |
| Column | Allows selection of single column at a time. | ![single column selection](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/selection-column.png) |
| ColumnRange | Allows selection of multiple contiguous columns at a time. | ![column range selection](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/selection-columnrange.png) |
| Row | Allows selection of single row at a time. | ![single row selection](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/selection-row.png) |
| RowRange | Allows selection of multiple contiguous rows at a time. | ![row range selection](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/selection-rowrange.png) |
| MultiRange | Allows selection of collection of ranges. | ![](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/multirange-selection.png) |
| ListBox | Allows selection of non-contiguous rows by ctrl+clicking. | ![](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/listbox-selection.png) |
| MultiColumns | Allows selection of non-contiguous columns by ctrl+clicking. | ![](https://cdn.mescius.io/document-site-files/images/4e85e507-742e-4a29-b3fe-f23b37c29164/images/multicolumns-selection.png) |

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](/componentone/docs/maui/online-maui/maui-controls/flexgrid/flexgrid-quickstart) topic.

**xml**

```xml
<c1:FlexGrid x:Name="grid" AutoGenerateColumns="False" SelectionMode="CellRange">
    <c1:FlexGrid.Columns>
        <c1:GridColumn Binding="FirstName" />
        <c1:GridColumn Binding="LastName" />
        <c1:GridColumn Binding="City"/>
        <c1:GridColumn Binding="Country"/>
        <c1:GridColumn Binding="Active"/>
    </c1:FlexGrid.Columns>
</c1:FlexGrid>
```

**csharp**

```csharp
// set the selection mode
grid.SelectionMode = GridSelectionMode.CellRange;
```