Skip to main content
All docs
V25.2
  • List Box - Item Selection

    • 7 minutes to read

    The DevExpress Blazor List Box supports the following selection modes: Single (default), Multiple, or None. Use the SelectionMode property to specify the mode.

    Single Selection (Default)

    Users can select one List Box item at a time.

    • Use the Value property to get or set the selected item (you can use two-way data binding).
    • Handle the ValueChanged event to respond to selection changes (if you use one-way data binding).
    <DxListBox Data="@Staff.DataSource"
               @bind-Value="@Value"
               TextFieldName="@nameof(Person.Text)"/>
    
    @code{
        Person Value;
    }
    

    List Box Selects One Item

    Run Demo: List Box - Overview

    Multiple Selection

    Users can select multiple items.

    The following code enables multiple selection in the List Box, adds checkboxes to items, and shows the Select All checkbox:

    @using StaffData
    
    <DxListBox Data="@Staff.DataSource"
               TextFieldName="@nameof(Person.Text)"
               SelectionMode="ListBoxSelectionMode.Multiple"
               ShowCheckboxes="true"
               ShowSelectAllCheckbox="true"
               @bind-Values="@Values">
    </DxListBox>
    
    @code {
        IEnumerable<Person> Values { get; set; }
    }
    

    ListBox ShowCheckboxes

    Run Demo: List Box - Multiple Selection

    Disable Selection

    Users cannot select items. Use this mode when you want to display a read-only list of items, handle item clicks without selection state, or create a custom selection behavior.

    @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);
    }
    

    Select Items in the UI

    Users can select List Box items in the following ways:

    Mouse/Touch

    • In single selection mode, click or tap an item.
    • In multiple selection mode:
      • Hold Ctrl and click items to select them individually.
      • Hold Shift to select a range of items.
      • Click checkboxes next to items (when ShowCheckboxes is true).
      • Click the Select All checkbox (when both ShowSelectAllCheckbox and ShowCheckboxes are true).

    Keyboard

    • Use and arrows to focus an item.
    • Press Space to select/deselect the focused item.
    • Press Enter to trigger an item click (requires an ItemClick event handler).

    Refer to List Box - Keyboard Support for more information.