blazor-devexpress-dot-blazor-dot-dxdropdownbox-ef391f72.md
Specifies a lambda expression that identifies the Value property’s bound value when the editor is placed in the EditForm.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public Expression<Func<object>> ValueExpression { get; set; }
| Type | Description |
|---|---|
| Expression<Func<Object>> |
A lambda expression that identifies the bound value.
|
The ValueExpression property obtains metadata about the value bound to the Value property. It is used when you add a DxDropDownBox to Blazor’s standard EditForm component to validate the Value property value.
You can set up this property in one of the following ways:
ValueExpression properties and handle the ValueChanged event.<DxDropDownBox Value="@Value"
ValueExpression="@(() => Value)"
ValueChanged="@((object newValue) => OnValueChanged(newValue))" ...>
@* ... *@
</DxDropDownBox>
@code {
object Value { get; set; }
void OnValueChanged(object newValue) {
Value = newValue;
// ...
}
}
Value property to implement two-way binding. In this case, the ValueExpression property is set internally.<DxDropDownBox @bind-Value="Value" ... />
@code {
object Value { get; set; }
// ...
}
The following exception occurs if you do not use two-way binding or the ValueExpression property:
DevExpress.Blazor.DxDropDownBox requires a value for the ‘ValueExpression’ property. It is specified automatically when you use two-way binding (‘bind-Value’).
See Also