Skip to main content
A newer version of this page is available. .

DiagramControl.ShowingOpenDialog Event

Fires before showing an ‘Open File’ dialog, and allows it to be customized or replaced.

Namespace: DevExpress.XtraDiagram

Assembly: DevExpress.XtraDiagram.v18.2.dll

Declaration

[DiagramCategory(DiagramCategory.DiagramDocument)]
public event EventHandler<DiagramShowingOpenDialogEventArgs> ShowingOpenDialog

Event Data

The ShowingOpenDialog event's data class is DiagramShowingOpenDialogEventArgs. 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.
DocumentSourceToOpen Gets or sets the object from which to load 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.
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 ‘Open’ action that allows an end-user to load a diagram from an external file. The ShowingOpenDialog event fires when the ‘Open File’ 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 load dialog.

You can also use the following event parameters:

  • DocumentSourceToOpen - allows you to specify the object from which to automatically load the diagram. This object can be a file full path, Uri object, stream and array of bytes. If this event parameter is set, a diagram will be automatically loaded from the specified source; the default ‘Open File’ dialog will not be invoked.

    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 from an empty stream). 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 ‘Open File’ 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 ‘Open File’ dialog.
  • Title - allows you to specify the ‘Open File’ dialog title.
See Also