DiagramControl.DocumentSource Property

Gets or sets the 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.

Namespace: DevExpress.XtraDiagram

Assembly: DevExpress.XtraDiagram.v20.1.dll

Declaration

[DefaultValue(null)]
[Browsable(false)]
public virtual object DocumentSource { get; set; }
<DefaultValue(Nothing)>
<Browsable(False)>
Public Overridable Property DocumentSource As Object

Property Value

Type Default Description
Object

null

The diagram source.

Remarks

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:

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.

Implements

DevExpress.Diagram.Core.IDiagramControl.DocumentSource
See Also