DiagramControl.DocumentSource Property

Specifies a document supplier for the DiagramControl. This is a dependency property.

Namespace: DevExpress.Xpf.Diagram

Assembly: DevExpress.Xpf.Diagram.v20.1.dll

Declaration

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

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:

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.

See Also