This example demonstrates how to define custom shapes for the DiagramControl in XML.
The ShapeTemplate class describes a diagram shape and contains the following segments:
- Start - Specifies the start point of the geometry and includes customization properties. A shape can consist of multiple geometries.
- Line - Defines a line with start and end points.
- Arc - Defines an arc with size and direction.
- ShapePoint - Defines a connection point. To specify connection points, use the ShapeTemplate.ConnectionPoints property.
- Parameter - Defines a parameter that allows users to transform the shape. To specify parameters, use the ShapeTemplate.Parameters property.
Refer to the following help topic for more information about supported segments: Creating Shapes and Containers Using Shape Templates.
To register custom shapes, create a stencil with the DiagramStencil.Create method and pass it to the DiagramToolboxRegistrator.RegisterStencil method.
To create a shape in code, 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")}
- CustomShapes.xml
- Form1.cs (VB: Form1.vb)
- Diagram Control for WinForms - Create Custom Shapes with Connection Points in XAML
- How to create a DiagramShape descendant and serialize its properties
- How to create custom diagram containers and register them in the toolbox and ribbon gallery
(you will be redirected to DevExpress.com to submit your response)