Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxListBox<TData, TValue>.SelectedItemsChanged Event

Fires after the selection changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public EventCallback<IEnumerable<TData>> SelectedItemsChanged { get; set; }

#Parameters

Type Description
IEnumerable<T>

A collection of selected items.

#Remarks

Handle the SelectedItemsChanged event to respond to item selection changes. This event fires in the following cases:

  • When users change item selection.
  • When Value and Values properties are changed at runtime or in code. This also refers to the first render.
Razor
<DxListBox Data="@Staff.DataSource"
           ValueFieldName="@nameof(Person.Id)"
           TextFieldName="@nameof(Person.Text)"
           @bind-Values="@Values"   
           SelectedItemsChanged="@((IEnumerable<Person> values) => SelectedItemsChanged(values))">
</DxListBox>

<p>@msg</p>

@code {
    string msg;

    IEnumerable<int> Values { get; set; } = Staff.DataSource.Take(12).Select(t => t.Id);

    void SelectedItemsChanged(IEnumerable<Person> values) {
      @* Only one item is present in the collection for single selection List Box *@
      msg = values.First().FirstName + " " + values.First().LastName + " is selected";
    }
}

Event usage example

See Also