RichEditControl.DocumentSource Property
Gets or sets a document supplier for RichEditControl. This is a dependency property.
Namespace: DevExpress.Xpf.RichEdit
Assembly: DevExpress.Xpf.RichEdit.v24.2.dll
NuGet Package: DevExpress.Wpf.RichEdit
Declaration
Property Value
Type | Description |
---|---|
Object | A Object that is the document source. |
Remarks
The DocumentSource allows you to bind the RichEditControl to a document source from XAML. The RichEditControl supports the following data sources:
Tip
Set the DocumentSource property to the RichEditDocumentSource instance to set a strict format to the source document.
The DocumentSource is updated when the document is loaded by calling RichEditControl.LoadDocument or Document.LoadDocument methods, or by executing the LoadDocumentCommand.
If the document is created or loaded from a file or a stream using one of the File methods, the DocumentSource is updated to contain the path to this document.
When the document is loaded from a stream, the DocumentSource property doesn’t reference the used stream, but contains the StreamSource instance instead. As a result, the stream can be safely reduced by the garbage collector.
Set the DXRichEditBehaviorOptions.KeepStreamInDocumentSource property to true to change this behavior and pass the stream reference to the DocumentSource property. Note that in this case, the garbage collector will not be able to collect the stream.
You can use the DXBinding extension to call a method that returns a valid document source directly in XAML, as in the following code:
<dxre:RichEditControl Name="richEditControl1" CommandBarStyle="Ribbon" DocumentSource="{DXBinding '$local:SourceHelper.GetDocumentSource()'}">
</dxre:RichEditControl>
Important
The format of an encrypted file cannot be detected. Use the RichEditDocumentSource instance to bind an encrypted file.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the DocumentSource property.
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.