Back to Devexpress

DxRichEdit.ModifiedChanged Event

blazor-devexpress-dot-blazor-dot-richedit-dot-dxrichedit-619fd1ae.md

latest1.8 KB
Original Source

DxRichEdit.ModifiedChanged Event

Allows you to track unsaved document changes.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

csharp
[Parameter]
public EventCallback<bool> ModifiedChanged { get; set; }

Parameters

TypeDescription
Boolean

A new property value.

|

Remarks

The ModifiedChanged occurs every time the Modified property value changes. The following example handles this event:

razor
<DxRichEdit @ref="richEdit" Modified="@modified" @bind-DocumentContent="@documentContent" 
    ModifiedChanged="@((value) => OnModifiedChanged(value))" />
@code {
    DxRichEdit richEdit { get; set; }
    byte[] documentContent { get; set; }
    bool modified { get; set; }

    async Task OnModifiedChanged(bool value) {
    /* 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 {
            modified = value;
            if (modified) {
                // Your code
            }
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
    }
}

See Also

DxRichEdit Class

DxRichEdit Members

DevExpress.Blazor.RichEdit Namespace