Skip to main content

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.v22.2.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 Unit Price column contains a value equal to or greater than the specified value. To select rows, click the Select button.

Grid - Select Rows with the Specified Value

View Example: Select Rows that Contain the Specified Value

        <RowDefinition Height="Auto"/>
    <dxg:GridControl ItemsSource="{Binding Products}" AutoGenerateColumns="AddNew" SelectionMode="Row" SelectedItems="{Binding Selection}">
            <dxg:TableView AutoWidth="True" FadeSelectionOnLostFocus="False"/>
    <StackPanel Grid.Row="1" Orientation="Horizontal">
        <TextBlock Text="Minimum Price:" TextAlignment="Right" Padding="4"/>
        <TextBox x:Name="textBox" HorizontalAlignment="Left" Margin="0,0,5,0" Width="50"/>
        <Button Content="Select" HorizontalAlignment="Left" Command="{Binding SelectRowsCommand}" CommandParameter="{Binding Text, ElementName=textBox}"/>
public class ViewModel : ViewModelBase {
    public ViewModel() {
        Products = ProductList.GetData();
        Selection = new ObservableCollection<Product>() { Products.ElementAt(0) };
    public ObservableCollection<Product> Products { get { return this.GetValue<ObservableCollection<Product>>(); } set { SetValue(value); } }
    public ObservableCollection<Product> Selection { get { return this.GetValue<ObservableCollection<Product>>(); } set { SetValue(value); } }

    public void SelectRows(string textValue) {
        var value = double.Parse(textValue);
        Selection = new ObservableCollection<Product>(from item in Products where item.UnitPrice >= value select item);
    public bool CanSelectRows(string textValue) {
        return double.TryParse(textValue, out double value);

Example: How to Change the Appearance of Focused and Selected Cells

This example demonstrates how to use the View’s CellStyle property to define a custom appearance for focused and selected cells.

Customize Focused and Selected Cells

View Example: Change the Appearance of Focused and Selected Cells

    <Style x:Key="SelectionStateCellStyle" TargetType="dxg:LightweightCellEditor">
            <Trigger Property="SelectionState" Value="Selected">
                <Setter Property="Background" Value="Red"/>
                <Setter Property="Foreground" Value="White"/>
            <Trigger Property="SelectionState" Value="FocusedAndSelected">
                <Setter Property="Background" Value="Gray"/>
                <Setter Property="Foreground" Value="Black"/>
    <dxg:GridControl x:Name="grid" AutoGenerateColumns="AddNew" SelectionMode="Cell">
            <dxg:TableView AutoWidth="True" CellStyle="{StaticResource SelectionStateCellStyle}"/>
See Also