DxDropDownBox.ValueExpression Property
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.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public Expression<Func<object>> ValueExpression { get; set; }
Property Value
Type | Description |
---|---|
Expression<Func<Object>> | A lambda expression that identifies the bound value. |
Remarks
You can add a DxDropDownBox component to Blazor’s standard EditForm component to validate the Value property value. In this case, the ValueExpression
property is used to obtain metadata about the value bound to the Value property.
You should specify the ValueExpression
property if you handle the ValueChanged event and cannot use two-way binding.
<DxDropDownBox Value="@Value"
ValueExpression="@(() => object)"
ValueChanged="@((object newValue) => ValueChanged(newValue))" ...>
@* ... *@
</DxDropDownBox>
@code {
object Value { get; set; }
void OnValueChanged(object newValue) {
Value = newValue;
// ...
}
}
The ValueExpression
property is set internally if you use the @bind attribute for the Value property to implement two-way binding.
<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’).