DxListBox<TData, TValue>.SelectionMode Property

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

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

Property Value

Type Description
ListBoxSelectionMode

One of the ListBoxSelectionMode enumeration values.

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

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