Skip to main content

DxListBox<TData, TValue>.SelectionMode Property

Specifies selection mode.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public ListBoxSelectionMode SelectionMode { get; set; }

Property Value

Type Description
ListBoxSelectionMode

A ListBoxSelectionMode enumeration value.

Available values:

Name Description
Single

Users can only select one List Box item at once.

Multiple

Users can select multiple items in List Box.

None

Users cannot select items in List Box.

Remarks

Single Selection

The default property value (ListBoxSelectionMode.Single) specifies that users can select only one item at a time. To access/specify a selected item, use the Values property.

Run Demo: List Box - Overview

Multiple Selection

Set the SelectionMode property to ListBoxSelectionMode.Multiple to enable multiple selection in the List Box.

To select a range of rows, a user can click the first row in the range, hold down the Shift key, and click the last row in the range. To add a row to or remove a row from a selection, a user should hold down the Ctrl key and click that row. On touch devices, use long press gestures to select multiple rows.

If the ShowCheckboxes property is set to true, users can click items or corresponding checkboxes to select items.

To access/specify selected items, use the Values property.

@using BlazorApp.Data

<DxListBox Data="@Staff.DataSource"
           @bind-Values="@Values"
           TextFieldName="@nameof(Person.Text)"
           SelectionMode="ListBoxSelectionMode.Multiple"
           ShowCheckboxes="true" >
</DxListBox>

@code {
    IEnumerable<Person> Values { get; set; } = Staff.DataSource.Take(1);
}

ListBox Multiple Selection

Run Demo: List Box - Multiple Selection

Disable Selection

Set the SelectionMode property to ListBoxSelectionMode.None to disable selection in the List Box.

@using BlazorApp.Data

<DxListBox Data="@Staff.DataSource"
           @bind-Values="@Values"
           TextFieldName="@nameof(Person.Text)"
           SelectionMode="ListBoxSelectionMode.None" >
</DxListBox>

@code {
    IEnumerable<Person> Values { get; set; } = Staff.DataSource.Take(1);
}

Implements

DevExpress.Blazor.IListBox<TData, TValue>.SelectionMode
See Also