Skip to main content

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.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

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

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

<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