DxColorPalette.ValueExpression Property
Specifies a lambda expression that identifies the Value property’s bound value when the Color Palette is in the EditForm.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public Expression<Func<string>> ValueExpression { get; set; }
Property Value
Type | Description |
---|---|
Expression<Func<String>> | A lambda expression that identifies a bound value. |
Remarks
You can add the Color Palette to Blazor’s standard EditForm component to validate the variable bound to the Value property. In this case, the ValueExpression
property obtains metadata about the Value
property’s bound variable.
You should specify the ValueExpression property if you handle the ValueChanged event and cannot use two-way binding.
<DxColorPalette Value="@Value"
ValueChanged="OnValueChanged"
ValueExpression="@(() => Value )"/>
<p><b>Selected value:</b> @Value</p>
@code {
string Value { get; set; } = "#5BCA35";
void OnValueChanged(string newValue) {
Value = newValue;
// ...
}
}
The ValueExpression
property is set internally if you use the @bind attribute for the Value
property to implement two-way data binding.
<DxColorPalette @bind-Value="@Value"/>
<p><b>Selected value:</b> @Value</p>
@code {
string Value { get; set; } = "#5BCA35";
}
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.