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

DxTagBox<TData, TValue>.ValuesChanged Event

Fires after a collection of selected values changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public EventCallback<IEnumerable<TValue>> ValuesChanged { get; set; }

#Parameters

Type Description
IEnumerable<TValue>

A collection of selected values.

#Remarks

The ValuesChanged event fires each time the Values collection changes. To handle this event, specify TData and TValue properties explicitly:

Razor
<DxTagBox Data="@Staff.DataSource"
          TData="Person" 
          TValue="@Person"
          TextFieldName="@nameof(Person.Text)"
          Values="@Values"
          ValuesChanged="@ValuesChanged">
</DxTagBox>

@code {
    IEnumerable<Person> Values { get; set; }

    void ValuesChanged(IEnumerable<Person> values)
    {
        Values = values;
    }
}

Alternatively, you can define the event argument type and handle the event as follows:

Razor
<DxTagBox Data="@Staff.DataSource"
          TextFieldName="@nameof(Person.Text)"
          Values="@Values"
          ValuesChanged="@((IEnumerable<Person> e) => ValuesChanged(e))">
</DxTagBox>

@code {
    IEnumerable<Person> Values { get; set; }

    void ValuesChanged(IEnumerable<Person> values){
       Values = values;
    }
}

The following code snippet demonstrates a sample implementation of the Person class.

C#
public class Person {
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public Department Department { get; set; }

    public string Text => $"{FirstName} {LastName} ({Department} Dept.)";
}

View Example: Use the DxTagBox control as a filter for a Grid column

See Also