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>.Value Property

Gets or sets the selected item value.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public TValue Value { get; set; }

#Property Value

Type Description
TValue

The selected item value.

#Remarks

If you allow users to select only one item, you can do the following:

  • Use the Value property to access the List Box’s selected item value from a bound data source.
  • Handle the ValueChanged event to respond to selection changes.

If the List Box allows users to select multiple items, use the Values property and ValuesChanged event instead.

The Value property can return the following objects:

  • The selected item value if the ValueFieldName is specified.
  • The selected item if the ValueFieldName property is unspecified. Note that in this case, the List Box searches for a field named Value in the data source. An exception occurs in the following situations:
    • If the found Value data type differs from the bound Value type.
    • If the data source does not contain a field named Value.
@using BlazorProject.Data;

<DxListBox Data="Data" 
           @bind-Value="Value" 
           TextFieldName="@nameof(Person.Description)" />

@code{
    IEnumerable<Person> Data;
    Person Value;
    protected override async Task OnInitializedAsync() {
        Data = Staff.DataSource;
        Value = Data.First();
    }
}

List Box Selects One Item

#Implements

DevExpress.Blazor.IListBox<TData, TValue>.Value
See Also