blazor-devexpress-dot-blazor-dot-dxlistbox-2-4b9920c7.md
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.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public Expression<Func<TValue>> ValueExpression { get; set; }
| Type | Description |
|---|---|
| Expression<Func<TValue>> |
A lambda expression that identifies a bound value.
|
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:
ValueExpression properties and handle the ValueChanged event.<DxListBox Data="@Strings"
Value="@Value"
ValueExpression="@(() => Value )"
ValueChanged="((string v) => Value = v)" />
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
DxListBox<TData, TValue> Class