Skip to main content

DxRichEdit.Modified Property

Specifies whether the open document has unsaved changes.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

[DefaultValue(false)]
[Parameter]
public bool Modified { get; set; }

Property Value

Type Default Description
Boolean false

true if the document has unsaved changes; otherwise, false.

Remarks

The Modified property identifies whether an open document has unsaved changes only if you handle the DocumentContentChanged event to enable save operations. When the save operations are disabled, the Rich Text Editor sets the Modified property value to true after a first change and never updates the property value later.

The ModifiedChanged event occurs when the Modified property value changes.

Note

Document export operations do not affect the Modified property value.

The example below exports a document that has unsaved changes as ‘annual-report.rtf’ in the “C:\Users\Public" folder.

<DxRichEdit @ref="richEdit" @bind-DocumentContent="@documentContent" 
    @bind-Modified="@modified" />
@code {
    DxRichEdit richEdit { get; set; }
    byte[] documentContent { get; set; }
    bool modified { 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 {
            if (modified == true) {
                await richEdit.ExportDocumentAsync("C:\\Users\\Public\\annual-report.rtf", DocumentFormat.Rtf);
                modified = false;
            }
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also