DiagramControl.ShowingSaveDialog Event
Fires before showing a ‘Save File As’ dialog, and allows it to be customized or replaced.
Namespace: DevExpress.XtraDiagram
Assembly: DevExpress.XtraDiagram.v24.2.dll
Declaration
[DiagramCategory(DiagramCategory.DiagramDocument)]
public event EventHandler<DiagramShowingSaveDialogEventArgs> ShowingSaveDialog
Event Data
The ShowingSaveDialog event's data class is DiagramShowingSaveDialogEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
DefaultFileName | Gets or sets the default name of the file to which to save the diagram. |
DocumentSourceToSave | Gets or sets the object to which to save the diagram skipping the dialog window. This object can be a full file path, Uri object, stream or array of bytes. |
Filter | Gets or sets the string that determines the file filtering options that appear in the dialog. |
FilterIndex | Gets or sets which filtering option is selected by default. |
InitialDirectory | Gets or sets the path to the directory displayed by the dialog. |
Title | Gets or sets the title of the dialog. |
Remarks
The Diagram Control’s Ribbon menu provides the ‘Save’ and ‘Save As’ actions that allow an end-user to save a diagram to an external file. The ShowingSaveDialog event fires when the ‘Save File As’ dialog is about to be invoked. You can handle it to change the dialog options or prevent the dialog from being displayed. For instance, you can set the Cancel event parameter to true to suppress the default dialog and then show a custom diagram saving dialog.
You can also use the following event parameters:
- DefaultFileName - allows you to specify the default file name for the ‘Save File As’ dialog.
DocumentSourceToSave - allows you to specify the object to which the diagram should be automatically saved. This object can be a file full path, Uri object, stream or array of bytes. If this event parameter is set, a diagram will be automatically saved to the specified source; the default ‘Save File As’ dialog will not be invoked.
You may encounter exceptions when loading/saving a diagram (e.g., when trying to save a diagram to a read-only file). To handle or suppress these exceptions, use the DiagramControl.ExceptionMessage event.
- Filter - allows you to specify a filter string that specifies the file types and descriptions to display in the ‘Save File As’ dialog. This value will be used to initialize the System.Windows.Forms.FileDialog.Filter property.
- InitialDirectory - allows you to specify the initial directory displayed by the ‘Save File As’ dialog.
- Title - allows you to specify the ‘Save File As’ dialog title.