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.OpenFile() Method

In This Article

Displays the “Open File” dialog that allows an end-user to load an XML file containing a saved diagram.

Namespace: DevExpress.Xpf.Diagram

Assembly: DevExpress.Xpf.Diagram.v24.2.dll

NuGet Package: DevExpress.Wpf.Diagram

#Declaration

public void OpenFile()

#Remarks

The Diagram Control’s Ribbon menu contains the “Open” button that redirects the action to the OpenFile method. By default, the standard “Open File” dialog is shown by this method. The full name of the file selected in the “Open File” dialog is automatically assigned to the DiagramControl.DocumentSource property.

The DiagramControl.ShowingOpenDialog event allows you to replace the standard “Open File” dialog with a custom one or perform your own actions when the “Open” button (in the Ribbon menu) is clicked or when the OpenFile method is directly called.

To implement diagram custom loading logic, handle the DiagramControl.CustomLoadDocument event.

To load a saved diagram to the DiagramControl in code, use the DiagramControl.DocumentSource property or DiagramControl.LoadDocument 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