DxListBox<TData, TValue>.Values Property

Provides access to the List Box’s selected value/item collection.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

[Parameter]
public IEnumerable<TValue> Values { get; set; }

Property Value

Type Description
IEnumerable<TValue>

The List Box’s values/items.

Remarks

Use the Values property to access to the List Box’s list of item values/items from a bound data source. To respond to selection changes, handle the ValuesChanged event.

The Values property can return the following objects:

  • If the ValueFieldName property is specified, the Values property includes the selected item’s values.
  • If the ValueFieldName property is not specified, the Values property includes selected items.
<DxListBox Data="@Staff.DataSource"
          TextFieldName="@nameof(Person.Text)"
          @bind-Values="@SelectedStaff">
</DxListBox>

@code {
    IEnumerable<Person> SelectedStaff { get; set; } = new List<Person>() { Staff.DataSource[0] };
}

The code below demonstrates a sample implementation of the Person class.

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.)";
}

Run Demo: List Box - Overview

See Also