Skip to main content
A newer version of this page is available. .

DxListBox<TData, TValue>.SelectionMode Property

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

NuGet Package: DevExpress.Blazor

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.

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

@code {
    IEnumerable<Person> Values = Staff.DataSource.Take(2);
    IEnumerable<Person> Values {
        get => Values;
        set { Values = value; InvokeAsync(StateHasChanged); }
    }
}

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.

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