Back to Devexpress

RichEditControl.CreateNewDocument(Boolean) Method

wpf-devexpress-dot-xpf-dot-richedit-dot-richeditcontrol-dot-createnewdocument-x28-system-dot-boolean-x29.md

latest2.3 KB
Original Source

RichEditControl.CreateNewDocument(Boolean) Method

Creates and loads a new empty document. Optionally raises the DocumentClosing event.

Namespace : DevExpress.Xpf.RichEdit

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

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
public virtual bool CreateNewDocument(
    bool raiseDocumentClosing = false
)
vb
Public Overridable Function CreateNewDocument(
    raiseDocumentClosing As Boolean = False
) As Boolean

Optional Parameters

NameTypeDefaultDescription
raiseDocumentClosingBooleanFalse

true, to raise the RichEditControl.DocumentClosing event; otherwise, false.

|

Returns

TypeDescription
Boolean

true, if a new document is created and loaded; otherwise, false.

|

Remarks

The CreateNewDocument helps prevent users from losing unsaved changes when a new document is created.

If the raiseDocumentClosing parameter is set to true and the RichEditControl’s document has unsaved changes (the RichEditControl.Modified property is true ), the RichEditControl.DocumentClosing event is fired.

By handling the DocumentClosing event, you can set e.Cancel to true to cancel unloading a document. A new document will not be created and the CreateNewDocument method returns false.

If the new document was created and successfully loaded, the CreateNewDocument method returns true.

See Also

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace