Skip to main content

DxRichEdit.FocusAsync(CancellationToken) Method

Sets input focus to the Rich Text Editor.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v23.2.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public ValueTask FocusAsync(
    CancellationToken cancellationToken = default(CancellationToken)
)

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken null

An object that propagates a cancellation notification.

Returns

Type Description
ValueTask

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

Remarks

The example below shows how to focus the Rich Text Editor.

<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit { get; set; }
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
        @* ... *@
            await richEdit.FocusAsync();
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also