Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

C#
[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.

Razor
<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.

Razor
<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.

See Also