Skip to main content

DxListBox<TData, TValue>.SelectedItemsChanged Event

Fires after the selection changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[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.
<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