DiagramControl.DocumentSource Property
Specifies a document supplier for the DiagramControl. This is a dependency property.
Namespace: DevExpress.Xpf.Diagram
Assembly: DevExpress.Xpf.Diagram.v24.1.dll
NuGet Package: DevExpress.Wpf.Diagram
Declaration
Property Value
Type | Description |
---|---|
Object | An object that contains data for the DiagramControl. |
Remarks
The DocumentSource property specifies an object from which a diagram is to be loaded or has been loaded. The current diagram is also saved to this object by certain Save actions. The DocumentSource can be a file full path, Uri object, stream and array of bytes.
When you specify the DocumentSource property in code, contents of this object are immediately loaded into the Diagram Control (it is supposed that the specified object stores a diagram in XML format).
Saving the current diagram into the object referred to by the DocumentSource property is initiated in the following cases:
- by the DiagramControl.SaveFile/DiagramControl.SaveFileAs method;
- by clicking on the Save button in the Diagram Control’s Ribbon menu
You may encounter exceptions when loading/saving a diagram (e.g., when trying to load a diagram from a file that does not exist, or saving to a read-only file). To handle or suppress these exceptions, use the DiagramControl.ExceptionMessage event.
An end-user can load a diagram from an external file using the ‘Open File’ dialog accessible from the Diagram Control’s Ribbon menu. In this case, the loaded file’s full path is automatically assigned to the DocumentSource property. When an end-user saves the diagram to a file using the ‘Save File As’ dialog, the new file name is automatically assigned to the DocumentSource property.
It is possible to customize or suppress the ‘Open File’ and ‘Save File As’ dialogs with the DiagramControl.ShowingOpenDialog and DiagramControl.ShowingSaveDialog events.
To override the diagram load and save logic, handle the DiagramControl.CustomLoadDocument and DiagramControl.CustomSaveDocument events.