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.v25.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
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:
- Specify Value and
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;
// ...
}
}
- Use the @bind attribute for the
Value
property to implement two-way binding. In this case, theValueExpression
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’).