Skip to main content
A newer version of this page is available. .

DxRichEdit.SelectionChanged Event

Fires after the selection is changed.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

[Parameter]
public EventCallback<Selection> SelectionChanged { get; set; }

Parameters

Type Description
Selection

A new value of the Selection property.

Remarks

Handle the SelectionChanged event to react to selection changes.

<DxRichEdit @ref="richEdit" Selection="@selection" SelectionChanged="OnSelectionChanged" />

@code {
    DxRichEdit richEdit { get; set; }
    Selection selection { get; set; }

    async Task OnSelectionChanged(Selection newSelection) {
    /* 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 cancelled. */
        try {
            selection = newSelection;
            // Your code
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
    }
}
See Also