[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
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [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
   [Collapse]Examples
     How to Handle DiagramControl Events to Save Diagrams to a Database
     How to: Change the Set of Shapes Available In the Shapes Panel
     How to Create a Custom Theme for Shapes in DiagramDesignerControl
     How to Create Custom Shapes with Custom Connection Points for DiagramDesignerControl
     How to Use Custom Graph Layout Algorithms to Arrange Shapes in DiagramControl
     How to Modify RibbonControl Items and Properties in DiagramDesignerControl
     How to: Create Items with Custom Content in DiagramControl
     How to: Create a DiagramShape Descendant and Serialize Its Properties
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Create Items with Custom Content in DiagramControl

Simple shapes in DiagramControl display only their content as an editable string. If it's necessary to add custom elements to diagram items, use the DiagramContentItem class. DiagramContentItem has the DiagramContentItem.ContentTemplate property, which can be used to put any elements into the item.

To register DiagramContentItem in the toolbox, use the DiagramStencil.RegisterTool method with FactoryItemTool as a parameter:

After that, register the stencil using DiagramToolboxRegistrator.RegisterStencil.

Please note that to properly deserialize DiagramContentItem, it's necessary to set its CustomStyleId property, which accepts a key of a Style applied to the item.

The following example shows how to create diagram items that display custom content.

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