Skip to main content

DxRadioGroup<TData, TValue>.ValueExpression Property

Specifies a lambda expression that identifies the Value property’s bound value when the Radio Group is placed in the EditForm.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Expression<Func<TValue>> ValueExpression { get; set; }

Property Value

Type Description
Expression<Func<TValue>>

A lambda expression that identifies the bound value.

Remarks

You can add the Radio Group 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.

<DxRadioGroup Items="@Strings"
              Value="@Value"
              ValueExpression="@(() => Value )"
              ValueChanged="@ValueChanged">
</DxRadioGroup>

@code {
    string Value = null;
    // ...
    void ValueChanged(string MyString) {
        // ...
    }
}

The ValueExpression property is set internally if you use the @bind attribute for the Value property to implement two-way binding.

<DxRadioGroup Items="@Languages"
              @bind-Value="@PreferredLanguage"/>
<p>Preferred language:
    <strong>@PreferredLanguage</strong>
</p>

@code {
    string PreferredLanguage { get; set; } = "English";
    IEnumerable<string> Languages = new[] { "English", "简体中文", "Español", "Français", "Deutsch" };
}
See Also