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

The ValueExpression property obtains metadata about the value bound to the Value property. It is used when you add a DxListBox<TData, TValue> to Blazor’s standard EditForm component to validate the Value property value.

You can use one of the following ways to set up this property:

<DxListBox Data="@Strings"
           Value="@Value"
           ValueExpression="@(() => Value )"
           ValueChanged="((string v) => Value = v)" />
  • Use the @bind attribute for the Value property to implement two-way binding. In this case, the ValueExpression property is set internally.
<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