Files to look at:
- CustomShapes.xaml (VB: CustomShapes.xaml)
- MainWindow.xaml (VB: MainWindow.xaml)
- MainWindow.xaml.cs (VB: MainWindow.xaml.vb)
How to create custom shapes with custom connection points for DiagramDesignerControl
The Diagram control supports a special language for defining shapes. The main element that contains shape description is ShapeTemplate. This element describes a shape contour and may contain several segments
- Start. Specifies the start point
- Line. Defines a line with start and end points
- Arc. Defines an arc with start and end points
To specify connection points, use the ShapeTemplate.ConnectionPoints property.
To register custom shapes, create a stencil with the DiagramStencil.Create method and pass it to the DiagramToolboxRegistrator.RegisterStencil method.
To create a shape programmatically, get an instance of your custom stencil, call the DiagramStencil.GetShape method to access the ShapeDescription object, and assign it to the DiagramShape.Shape property:
new DiagramShape() { Shape = customStencil.GetShape("Shape1")}