DxRadioGroup<TData, TValue>.TextFieldName Property
Specifies the data source field that contains text for Radio Group items.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public string TextFieldName { get; set; }
Property Value
Type | Description |
---|---|
String | A string value that specifies a data source field’s name. |
Remarks
<legend>Select your drink:</legend>
<DxRadioGroup Items="@Drinks"
@bind-Value="@SelectedDrinkId"
ValueFieldName="@nameof(Product.ProductId)"
EnabledFieldName="@nameof(Product.InStock)"
TextFieldName="@nameof(Product.ProductName)">
</DxRadioGroup>
<p>
You have selected:
<strong>@GetDrinkName()</strong>
</p>
@code {
int SelectedDrinkId { get; set; } = 2;
IEnumerable<Product> Products { get; set; }
IEnumerable<Product> drinks;
IEnumerable<Product> Drinks {
get => drinks;
set {
drinks = value;
InvokeAsync(StateHasChanged);
}
}
protected override async Task OnInitializedAsync() {
Products = await NwindDataService.GetProductsAsync();
Drinks = Products.Where(p => p.CategoryId == 1).Take(5).AsEnumerable();
}
string GetDrinkState(Product product) => product.InStock ? $"({product.UnitsInStock} units left)" : "(out of stock)";
string GetDrinkName() => Drinks.First(p => p.ProductId == SelectedDrinkId).ProductName;
}
See Also