Back to Devexpress

DxRadioGroup<TData, TValue>.ValueExpression Property

blazor-devexpress-dot-blazor-dot-dxradiogroup-2-8d4ec1fc.md

latest2.5 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

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

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

razor
<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

DxRadioGroup<TData, TValue> Class

DxRadioGroup<TData, TValue> Members

DevExpress.Blazor Namespace