Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DiagramControl.SaveFile() Method

In This Article

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.v24.2.dll

NuGet Package: DevExpress.Win.Diagram

#Declaration

public void 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