RichEditControl.ContentChanged Event
Occurs when the document content was changed.
Namespace: DevExpress.XtraRichEdit
Assembly: DevExpress.XtraRichEdit.v18.2.dll
Declaration
Event Data
The ContentChanged event's data class is EventArgs.
Remarks
This event occurs in the following situations:
- a document is loaded into the RichEditControl using the RichEditControl.LoadDocument methods
- a document is loaded using specific properties such as RichEditControl.Text, RichEditControl.RtfText, RichEditControl.HtmlText, RichEditControl.MhtText, RichEditControl.WordMLText
- a new document is created
- the text of the document is changed
- document formatting is modified
Generally the ContentChanged event is fired several times when a document is modified. Since it depends on the complexity of the modification, so you are advised against counting the number of times an event fires.
Note that methods such as SubDocument.InsertText and SubDocument.InsertDocumentContent result in significant changes of the internal document model. The ContentChanged event occurs two times in this case, and you cannot predict when the second ContentChanged event fires.
To distinguish between loading a new document and a situation when the document is modified, use the RichEditControl.Modified property within the event handler. When a document is newly created using the RichEditControl.CreateNewDocument method, loaded from a file or from a stream, or created by assigning a value to a certain text property, the Modified value is false. Otherwise, it is set to true.
The System.Windows.Forms.Control.TextChanged event is fired in the same situations as the ContentChanged event.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ContentChanged event.
Note
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.