Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]Controls and Libraries
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Collapse]API Reference
  [Expand]DevExpress.Charts.Designer
  [Expand]DevExpress.Mvvm.UI
  [Expand]DevExpress.Mvvm.UI.Interactivity
  [Expand]DevExpress.Mvvm.UI.ModuleInjection
  [Expand]DevExpress.Xpf.Accordion
  [Expand]DevExpress.Xpf.Bars
  [Expand]DevExpress.Xpf.Carousel
  [Expand]DevExpress.Xpf.Charts
  [Expand]DevExpress.Xpf.Charts.Localization
  [Expand]DevExpress.Xpf.Charts.RangeControlClient
  [Expand]DevExpress.Xpf.ChunkList
  [Expand]DevExpress.Xpf.Controls
  [Expand]DevExpress.Xpf.Core
  [Expand]DevExpress.Xpf.Core.ConditionalFormatting
  [Expand]DevExpress.Xpf.Core.DataSources
  [Expand]DevExpress.Xpf.Core.ServerMode
  [Expand]DevExpress.Xpf.Data
  [Expand]DevExpress.Xpf.DataAccess
  [Expand]DevExpress.Xpf.DataAccess.DataSourceWizard
  [Collapse]DevExpress.Xpf.Diagram
   [Expand]DiagramCommands Class
   [Expand]DiagramConnector Class
   [Expand]DiagramContainer Class
   [Expand]DiagramContainerBase Class
   [Collapse]DiagramControl Class
     DiagramControl Members
     DiagramControl Constructor
    [Expand]DiagramControl Properties
    [Expand]DiagramControl Events
    [Collapse]DiagramControl Methods
      AlignCanvas Method
      AlignPage Method
     [Expand]ApplyCircularLayout Method
     [Expand]ApplySugiyamaLayout Method
     [Expand]ApplyTipOverTreeLayout Method
     [Expand]ApplyTipOverTreeLayoutForSubordinates Method
     [Expand]ApplyTreeLayout Method
     [Expand]ApplyTreeLayoutForSubordinates Method
      AttachToWindow Method
      BeginInit Method
      BringItemsForward Method
      BringItemsIntoView Method
      BringItemsToFront Method
      BringSelectedItemsForward Method
      BringSelectedItemsToFront Method
      BringSelectionIntoView Method
     [Expand]CalcHitInfo Method
     [Expand]CalcHitItem Method
      ChangeConnectorsType Method
      ChangeSelectedConnectorsType Method
      ClearSelection Method
      CopySelectedItems Method
      CreateAdorner Method
      CreateAdornerEx<TObject, TInterface> Method
      CreateBackgroundAdorner Method
      CreateHRulerAdorner Method
      CreateVRulerAdorner Method
      CutSelectedItems Method
      DeleteItems Method
      DeleteSelectedItems Method
      DetachFromWindow Method
      EndInit Method
     [Expand]ExportDiagram Method
      FitToDrawing Method
      FitToItems Method
      FitToPage Method
      FitToWidth Method
      GetDiagram Method
      GetDrawingContext Method
      InsertImage Method
     [Expand]LoadDocument Method
      LoadImage Method
      NewDocument Method
      NewFile Method
      OnApplyTemplate Method
      OpenFile Method
      Paste Method
      PointToControl Method
      PointToDocument Method
      Print Method
      QuickPrint Method
      ResetSelectedImages Method
     [Expand]SaveDocument Method
      SaveFile Method
      SaveFileAs Method
      ScrollToPoint Method
      SelectAll Method
      SelectItem Method
     [Expand]SelectItems Method
      SendItemsBackward Method
      SendItemsToBack Method
      SendSelectedItemsBackward Method
      SendSelectedItemsToBack Method
      SetDiagram Method
      SetDrawingContext Method
      SetSelectedImagesScale Method
      SetSelectedImagesStretchMode Method
      ShowEditor Method
      ShowPrintPreview Method
      UnselectItem Method
      UpdateConnectorsRoute Method
      ZoomIn Method
      ZoomOut Method
   [Expand]DiagramCustomCursorEventArgs Class
   [Expand]DiagramDataBindingBehavior Class
   [Expand]DiagramDataBindingBehaviorBase Class
   [Expand]DiagramDesignerControl Class
    DiagramDrawingContext Enumeration
   [Expand]DiagramImage Class
   [Expand]DiagramItem Class
   [Expand]DiagramOrgChartBehavior Class
   [Expand]DiagramShape Class
  [Expand]DevExpress.Xpf.Docking
  [Expand]DevExpress.Xpf.Docking.Base
  [Expand]DevExpress.Xpf.DocumentViewer
  [Expand]DevExpress.Xpf.Editors
  [Expand]DevExpress.Xpf.Editors.DateNavigator
  [Expand]DevExpress.Xpf.Editors.ExpressionEditor
  [Expand]DevExpress.Xpf.Editors.Filtering
  [Expand]DevExpress.Xpf.Editors.Flyout
  [Expand]DevExpress.Xpf.Editors.Flyout.Native
  [Expand]DevExpress.Xpf.Editors.Helpers
  [Expand]DevExpress.Xpf.Editors.Popups
  [Expand]DevExpress.Xpf.Editors.RangeControl
  [Expand]DevExpress.Xpf.Editors.Settings
  [Expand]DevExpress.Xpf.Editors.Validation
  [Expand]DevExpress.Xpf.Gauges
  [Expand]DevExpress.Xpf.Gauges.Localization
  [Expand]DevExpress.Xpf.Grid
  [Expand]DevExpress.Xpf.Grid.ConditionalFormatting
  [Expand]DevExpress.Xpf.Grid.LookUp
  [Expand]DevExpress.Xpf.Grid.TreeList
  [Expand]DevExpress.Xpf.Layout.Core
  [Expand]DevExpress.Xpf.LayoutControl
  [Expand]DevExpress.Xpf.Map
  [Expand]DevExpress.Xpf.NavBar
  [Expand]DevExpress.Xpf.Navigation
  [Expand]DevExpress.Xpf.PdfViewer
  [Expand]DevExpress.Xpf.PivotGrid
  [Expand]DevExpress.Xpf.PivotGrid.Printing
  [Expand]DevExpress.Xpf.Printing
  [Expand]DevExpress.Xpf.Printing.Parameters
  [Expand]DevExpress.Xpf.Printing.Parameters.Models
  [Expand]DevExpress.Xpf.Printing.PreviewControl.Bars
  [Expand]DevExpress.Xpf.Prism
  [Expand]DevExpress.Xpf.PropertyGrid
  [Expand]DevExpress.Xpf.Reports.UserDesigner
  [Expand]DevExpress.Xpf.Reports.UserDesigner.Extensions
  [Expand]DevExpress.Xpf.Reports.UserDesigner.Localization
  [Expand]DevExpress.Xpf.Reports.UserDesigner.ReportWizard
  [Expand]DevExpress.Xpf.Reports.UserDesigner.ReportWizard.Pages
  [Expand]DevExpress.Xpf.Ribbon
  [Expand]DevExpress.Xpf.RichEdit
  [Expand]DevExpress.Xpf.Scheduler
  [Expand]DevExpress.Xpf.Scheduler.Drawing
  [Expand]DevExpress.Xpf.Scheduler.Menu
  [Expand]DevExpress.Xpf.Scheduler.Reporting
  [Expand]DevExpress.Xpf.Scheduler.UI
  [Expand]DevExpress.Xpf.SpellChecker
  [Expand]DevExpress.Xpf.Spreadsheet
  [Expand]DevExpress.Xpf.Spreadsheet.Menu
  [Expand]DevExpress.Xpf.TreeMap
  [Expand]DevExpress.Xpf.Utils.Themes
  [Expand]DevExpress.Xpf.WindowsUI
  [Expand]DevExpress.Xpf.WindowsUI.Navigation
  [Expand]DevExpress.XtraRichEdit
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

DiagramControl.OpenFile Method

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.v17.1.dll

Expanded Syntax

Expanded 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 DocumentSource property.

The 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 CustomLoadDocument event.

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

Expanded See Also

How would you rate this topic?​​​​​​​