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

Specifies a lambda expression that identifies the Value property’s bound value when the List Box is in the EditForm.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public Expression<Func<TValue>> ValueExpression { get; set; }

#Property Value

Type Description
Expression<Func<TValue>>

A lambda expression that identifies a bound value.

#Remarks

You can add the List Box editor to Blazor’s standard EditForm component to validate the variable bound to the Value property. In this case, the ValueExpression property obtains metadata about the Value property’s bound variable.

You should specify the ValueExpression property if you handle the ValueChanged event and cannot use two-way binding.

Razor
<DxListBox Data="@Strings"
           Value="@Value"
           ValueExpression="@(() => Value )"
           ValueChanged="((string v) => Value = v)" />

The ValueExpression property is set internally if you use the @bind attribute for the Value property to implement two-way binding.

Razor
<DxListBox Data="@Strings"
           @bind-Value="@Value" />

@code {
    String newValue = null;
    String Value { get => newValue; set { newValue = value; } }
    @* ... *@
}

The following exception occurs if you do not use two-way binding and do not specify the ValueExpression property:

The ‘ValuesExpression’ or ‘ValueExpression’ property is required. Use two-way binding (‘bind-Value’ or ‘bind-Values’) to define these properties automatically.

See Also