This example uses the DiagramDataBindingBehavior to generate a diagram from a data source or collection.
-
Add the DiagramDataBindingBehavior to the DiagramControl.
-
Specify the following properties to map the behavior to data:
- The ItemsSource property specifies a collection of diagram items.
- The KeyMember and ConnectorsSource properties allow you to display relationships between diagram items.
- The ConnectorFromMember and ConnectorToMember properties specify data fields that contain a connector's begin and end items.
-
Use the Item Template Designer to create "templates" for diagram items and connectors.
This designer creates a TemplateDiagram object that contains generated code with diagram shapes and connectors.
-
Handle the GenerateItem and GenerateConnector events to display different items based on a condition.
In these event handlers, the TemplateName property value allows you to identify generated "templates".
- ClassData.cs (VB: ClassData.vb)
- ClassStructureGenerator.cs (VB: ClassStructureGenerator.vb)
- MainWindow.xaml (VB: MainWindow.xaml)
- MainWindow.xaml.cs (VB: MainWindow.xaml.vb)
- ViewModel.cs (VB: ViewModel.vb)
- WPF Diagram - Generate Diagrams with Grouped Items
- WPF Diagram - Use the DiagramOrgChartBehavior to Generate a Diagram from a Collection
(you will be redirected to DevExpress.com to submit your response)