Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxRadioGroup<TData, TValue>.FocusAsync() Method

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public ValueTask FocusAsync()

#Returns

Type Description
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.

<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();
    }
}

Focus Async

See Also