DxRadio<TValue>.GroupValueExpression Property
Specifies a lambda expression that identifies the GroupValue property’s bound value when the Radio is placed in the EditForm.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public override Expression<Func<TValue>> GroupValueExpression { get; set; }
Property Value
Type | Description |
---|---|
Expression<Func<TValue>> | A lambda expression that identifies the bound value. |
Remarks
You can add a Radio button to Blazor’s standard EditForm component to validate the GroupValue property value. In this case, the GroupValueExpression
property is used to obtain metadata about the value bound to the GroupValue
property.
You should specify the GroupValueExpression
property if you handle the GroupValueChanged event and cannot use two-way binding.
@foreach {
<DxRadio ...
GroupValue="@Value"
GroupValueExpression="@(() => Value )"
GroupValueChanged="@GroupValueChanged">
...
</DxRadio>
}
@code {
string Value = null;
void GroupValueChanged(string MyString) {
// ...
}
}
The GroupValueExpression
property is set internally if you use the @bind attribute for the GroupValue
property to implement two-way binding.
@foreach(var option in GeneralAnswerOptions) {
<DxRadio GroupName="general-radio-group"
@bind-GroupValue="@GeneralAnswer"
Value="@option">
@option
</DxRadio>
}
@code {
string GeneralAnswer { get; set; }
IEnumerable<string> GeneralAnswerOptions = new[] {
"Yes.",
"No, but I plan to develop a WebAssembly app in the near future.",
"No."
};
}