DiagramControl.SaveFile() Method

Saves the diagram to storage specified by the DiagramControl.DocumentSource. If the DiagramControl.DocumentSource is not set, the DiagramControl.SaveFileAs method is called, that invokes the "Save File As" dialog.

Namespace: DevExpress.XtraDiagram

Assembly: DevExpress.XtraDiagram.v20.1.dll

Declaration

public void SaveFile()
Public Sub SaveFile

Remarks

The Diagram Control's Ribbon menu contains the "Save" button that redirects the save action to the SaveFile method. The SaveFile method saves the current diagram to storage specified by the DiagramControl.DocumentSource property. If the DiagramControl.DocumentSource property is not set, the SaveFile method delegates the saving logic to the DiagramControl.SaveFileAs method, which invokes the "Save File As" dialog.

The full name of the file to which the diagram is saved is automatically assigned to the DiagramControl.DocumentSource property.

To implement diagram custom saving logic, handle the DiagramControl.CustomSaveDocument event.

The DiagramControl.ShowingSaveDialog event allows you to replace the standard "Save File As" dialog with a custom one or perform your own actions when this dialog is about to be shown.

To save the diagram without invoking any dialogs in code, use the DiagramControl.SaveDocument method.

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.

See Also