Back to Devexpress

DxInputDataEditorBase<T>.FocusAsync() Method

blazor-devexpress-dot-blazor-dot-base-dot-dxinputdataeditorbase-1-05c596e5.md

latest1.4 KB
Original Source

DxInputDataEditorBase<T>.FocusAsync() Method

Moves focus to the component’s input element.

Namespace : DevExpress.Blazor.Base

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

The following code moves focus to the input element of the DxMaskedInput component after the first render.

razor
<DxMaskedInput @bind-Value="@Value"
               Mask="@NumericMask.Currency"
               @ref=@component>
</DxMaskedInput>

@code {
    DxMaskedInput<double> component;
    double Value { get; set; } = 123.45;

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

See Also

DxInputDataEditorBase<T> Class

DxInputDataEditorBase<T> Members

DevExpress.Blazor.Base Namespace