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
    [Collapse]DiagramControl Events
      AddingNewItem Event
      CanvasBoundsChanged Event
      ClosedEditor Event
      CustomCursor Event
      CustomGetEditableItemProperties Event
      CustomGetEditableItemPropertiesCacheKey Event
      CustomGetSerializableItemProperties Event
      CustomItemDrag Event
      CustomItemDragResult Event
      CustomItemGiveFeedback Event
      CustomItemQueryContinueDrag Event
      CustomLoadDocument Event
      CustomLoadImage Event
      CustomSaveDocument Event
      DeletingItems Event
      DocumentLoaded Event
      ExceptionMessage Event
      ItemContentChanged Event
      ItemCreating Event
      ItemInitializing Event
      ItemsChanged Event
      RelayoutItemsCompleted Event
      SelectionChanged Event
      ShowingEditor Event
      ShowingOpenDialog Event
      ShowingOpenImageDialog Event
      ShowingSaveDialog Event
      SubordinatesHidden Event
      SubordinatesHiding Event
      SubordinatesShowing Event
      SubordinatesShown Event
    [Expand]DiagramControl Methods
   [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.CustomLoadDocument Event

Fires after an end-user selects a document in the 'Open File' dialog or a document is loaded by setting the DocumentSource property in code.

Namespace:DevExpress.Xpf.Diagram
Assembly:DevExpress.Xpf.Diagram.v17.1.dll

Expanded Syntax

Expanded Event Data

The event handler receives an argument of type DevExpress.Xpf.Diagram.DiagramCustomLoadDocumentEventArgs containing data related to this event.

Expanded Remarks

The CustomLoadDocument event allows you to implement a custom logic for loading diagram data. The event's DocumentSource property represents the selected document supplier. Set the event's Handled property to true to disable the default loading mechanism and instead, use the implemented custom logic.

Expanded Example

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T329840.

This example demonstrates how to open and save diagrams to a custom storage (e.g., a database) instead of a file system. In the example, the following events are used to implement this functionality:

ShowingOpenDialog - This event fires before the standard Open dialog is shown and allows you to customize the dialog options or replace the standard dialog with a custom one. You can also cancel the Open operation by setting the e.Cancel parameter to true.

ShowingSaveDialog - Similarly to the ShowingOpenDialog event, the ShowingSaveDialog event allows you to customize the standard Save dialog in DiagramControl or replace it with a custom one. Setting the e.Cancel parameter to true will cancel the Save operation.

CustomLoadDocument - This event fires after a user selected a document in the Open dialog or the DocumentSource property was set in code. The event exposes the selected document source (e.g., a document name or a file stream) through the e.DocumentSource property and allows you to implement your own loading logic. For example, you can retrieve a diagram file from a database and load it into DiagramControl using the LoadDocument property (as demonstrated in the example) or populate the diagram with items manually. After implementing your custom loading logic, set the e.Handled parameter to true, so that DiagramControl does not load the previously selected document source.

CustomSaveDocument - The CustomSaveDocument event allows you to specify custom saving logic for your diagram. The event fires after the Save operation was initiated and selection was made in the Save dialog (if there was a dialog). The e.DocumentSource property specifies the default location (file name, stream, etc.) where the diagram will be saved. You can set the e.Handled parameter to true to cancel the standard saving logic and implement your custom one. For example, save the diagram to a stream using the SaveDocument method as demonstrated in the example or iterate through diagram items manually and read required information.

Expanded See Also

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