Back to Devexpress

DxRichEdit.SelectionChanged Event

blazor-devexpress-dot-blazor-dot-richedit-dot-dxrichedit-9d88c8dd.md

latest1.6 KB
Original Source

DxRichEdit.SelectionChanged Event

Fires after the selection is changed.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

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

Parameters

TypeDescription
Selection

A new value of the Selection property.

|

Remarks

Handle the SelectionChanged event to react to selection changes.

razor
<DxRichEdit Selection="@richSelection" SelectionChanged="OnSelectionChanged" />

@code {
    Selection richSelection { 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 canceled. */
        try {
            richSelection = newSelection;
            // Your code
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
    }
}

See Also

DxRichEdit Class

DxRichEdit Members

DevExpress.Blazor.RichEdit Namespace