Skip to main content

DxListBox<TData, TValue>.SelectionMode Property

Specifies how many List Box items can be selected at once.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.2.dll

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 List Box. Users can press Ctrl (for individual item) or Shift (for a range of items) and click items to select them. 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

We do not recommend that you use multiple selection and virtual scrolling (ListRenderMode set to Virtual) with a large data source. This may cause delays if a user attempts to select all list items.

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);
}
See Also