Skip to main content

RichEditControl.Modified Property

Gets or sets whether the control’s content was modified since it was last saved.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v24.1.dll

NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.RichEdit, DevExpress.Win.TreeMap


public bool Modified { get; set; }

Property Value

Type Default Description
Boolean false

true if the control’s content was modified since it was last saved; otherwise, false.


The following actions change the Modified property value:

RichEditControl and SnapControl

  • Add, delete, cut or paste content;
  • Change text format (font, paragraph properties, apply style, change direction);
  • Change document layout (insert section break, divide into columns, change margins, orientation);
  • Edit character, paragraph and table styles;
  • Insert or modify document elements (drawing objects, tables, comments, etc.);

The RichEditControl.SaveDocument, RichEditControl.SaveDocumentAs or Document.SaveDocument method call does not automatically change the Modified property value. However, the SaveDocumentCommand or SaveDocumentAsCommand execution changes the Modified property value to false.

When the Modified property value is changed, the RichEditControl.ModifiedChanged event raises.

The code sample below checks the Modified property in the RichEditControl.DocumentClosing event handler and shows the message box with the question whether to save changes before the application is closed.

void richEditControl_DocumentClosing(object sender, CancelEventArgs e)
    if (RichEdit.Modified)
        string currentFileName = RichEdit.Options.DocumentSaveOptions.CurrentFileName;
        string message = !string.IsNullOrEmpty(currentFileName) ?
            string.Format("Do you want to save the changes you made for '{0}'?", currentFileName) : "Do you want to save the changes?";
        DialogResult result = XtraMessageBox.Show(message, "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
        if (result == DialogResult.Yes)
        e.Cancel = result == DialogResult.Cancel;

The following code snippets (auto-collected from DevExpress Examples) contain references to the Modified property.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also