DataControlBase.SelectionMode Property

Gets or sets whether multiple row/cell selection is enabled. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v21.1.Core.dll


public MultiSelectMode SelectionMode { get; set; }

Property Value

Type Description

A MultiSelectMode enumeration value that specifies the selection mode.

Available values:

Name Description

Multi-selection is disabled.


Allows selection of multiple rows.


Allows selection of multiple cells.


Allows toggling the selection of multiple rows.


Multiple row/cell selection is not allowed if the DataViewBase.NavigationStyle property is set to GridViewNavigationStyle.None and/or the SelectionMode property is set to MultiSelectMode.None.

To enable multiple row selection, set the SelectionMode property to MultiSelectMode.Row.

To enable touch-friendly multiple row selection, set the SelectionMode property to MultiSelectMode.MultipleRow.

To enable multiple cell selection (block selection), set the SelectionMode property to MultiSelectMode.Cell.

To enable single row selection, set the DataViewBase.NavigationStyle property to GridViewNavigationStyle.Row and/or the SelectionMode property to MultiSelectMode.None.

For the CardView, setting the SelectionMode property affects card selection (similar to row selection in the TableView).

To disable card selection, set the SelectionMode property to MultiSelectMode.None or MultiSelectMode.Cell.

Example: How to Select Rows that Contain the Specified Value

This example shows how to select rows whose UnitPrice column contains a value equal to or greater than 20. To select rows, click the Select button.

View Example: How to select rows that contain the specified value

<Window x:Class="DXGrid_SelectRows.Window1" 
        Title="Window1" Height="293" Width="494">
        <dxg:GridControl Name="grid" AutoGenerateColumns="AddNew" SelectionMode="Row" Height="220">
                <dxg:TableView Name="tableView" AutoWidth="True" />
        <Button Content="Select" Width="50" Height="30" Margin="5" 
                HorizontalAlignment="Left" Click="Button_Click" />

Example: How to Change the Appearance of Selected Cells

You should implement your own CellStyle. In this CellStyle, implement style triggers for the SelectionState property. Four values can be assigned to this property: None, Focused, Selected, FocusedAndSelected.

View Example: How to change selected cells' appearance when GridControl's multi-cell selection is enabled

<Window x:Class="DXGrid_ChangeRowAppearance.Window1" 
        Title="Window1" Height="300" Width="505"
        <Style x:Key="SelectionStateCellStyle" TargetType="dxg:LightweightCellEditor" 
               BasedOn="{StaticResource ResourceKey={dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle}}">
                <Trigger Property="SelectionState" Value="Selected">
                    <Setter Property="Background" Value="Red"/>
                <Trigger Property="SelectionState" Value="Focused">
                    <Setter Property="Background" Value="Green"/>
                    <Setter Property="TextBlock.Foreground" Value="Pink"/>
                <Trigger Property="SelectionState" Value="FocusedAndSelected">
                    <Setter Property="Background" Value="Gray"/>
                    <Setter Property="TextBlock.Foreground" Value="Black"/>
        <Style x:Key="FocusedRowStyle" TargetType="dxg:RowControl">
                <Trigger Property="dxg:GridViewBase.IsFocusedRow" Value="True">
                    <Setter Property="Background" Value="Gray" />
                    <Setter Property="Foreground" Value="White" />
        <dxg:GridControl x:Name="grid" AutoGenerateColumns="AddNew" SelectionMode="Cell">
                <dxg:TableView AutoWidth="True" 
                               CellStyle="{StaticResource SelectionStateCellStyle}" 
                               ShowGroupPanel="False" AllowGrouping="False" 
See Also