Back to Devexpress

DxRadioGroup<TData, TValue>.FocusAsync() Method

blazor-devexpress-dot-blazor-dot-dxradiogroup-2-192ca426.md

latest1.5 KB
Original Source

DxRadioGroup<TData, TValue>.FocusAsync() Method

Moves focus to the RadioGroup’s first item (or selected item, if any).

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public ValueTask FocusAsync()

Returns

TypeDescription
ValueTask

A structure that stores an awaitable result of an asynchronous operation.

|

Remarks

In the following example, focus moves to the first item after the first render.

razor
<DxRadioGroup Items="@Values"
              @bind-Value="@Value"
              @ref="@component">
    <p><strong>@Value</strong></p>
</DxRadioGroup>

@code {
    DxRadioGroup<string, string> component;
    string Value { get; set; } = "Parking camera";
    IEnumerable<string> Values = new[] { "Parking camera", "Heated seats", "Air conditioning" };

    protected override void OnAfterRender(bool firstRender) {
        base.OnAfterRender(firstRender);
        component.FocusAsync();
    }
}

See Also

DxRadioGroup<TData, TValue> Class

DxRadioGroup<TData, TValue> Members

DevExpress.Blazor Namespace