[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Collapse]Diagram Control
    Getting Started
   [Expand]Diagram Control
   [Expand]End-User Interaction
   [Expand]Diagram Items
   [Expand]Automatic Layout
   [Expand]Data Binding
    Themes and Styles
    Printing and Exporting
    Saving and Loading Diagrams
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Saving and Loading Diagrams

A diagram can be saved to an XML file and then loaded from this file at design time and runtime.

At design time, use the dedicated Save, Save As and Open menu buttons provided by the Diagram Designer Control.

In code, a diagram can be saved/loaded to/from a file or stream with the DiagramControl.SaveDocument and DiagramControl.LoadDocument methods.

You can implement custom logic for loading and saving diagrams by handling the DiagramControl.CustomSaveDocument and DiagramControl.CustomLoadDocument events.

The DiagramContentItem.Content property that defines Items with Custom Content is serialized by default, provided that its content supports serialization. Simple types are supported out of the box. Custom types should be marked with the SerializableAttribute. See the Value types article in MSDN.

To enable serialization for custom item types, use the DiagramItemTypeRegistrator.Register method. To modify the list of serialized properties, use the DiagramControl.CustomGetSerializableItemProperties event. Alternatively, mark the additional properties of a custom item type with the DevExpress.Utils.Serializing.XtraSerializableProperty attribute.

Is this topic helpful?​​​​​​​