Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[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
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   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
  [Collapse]Diagram Control
    Getting Started
   [Expand]Diagram Designer Control
    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 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]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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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 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.

Show Me

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

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

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