Back to Devexpress

Connectors

wpf-116648-controls-and-libraries-diagram-control-diagram-items-connectors.md

latest2.6 KB
Original Source

Connectors

  • Apr 07, 2023
  • 3 minutes to read

Connectors are lines that connect shapes. When any of two connected shapes is being moved, the connector moves with the shape.

Connectors are encapsulated by DiagramConnector class objects.

There are two connection types.

  • Point connection - a connector is glued to a specific connection point on a shape.

  • Dynamic connection - a connector is glued to a connection point that is nearest to the connector’s point of origin.

A connector can have either connection type on either of its ends. The animation below illustrates two connection types.

According to the DiagramConnector.Type property, a connector can be:

  • Straight Line
  • Curve
  • Right angle.

A Straight Line connector with the dynamic connection type is glued to the center of a shape rather than to any of its connection points.

The connector’s starting and ending points can be:

  • Diagram shapes - A connector point on a shape will be determined automatically based on the diagram layout.

  • Certain connector points on diagram shapes.

  • Any points on the canvas.

The connector can display arrows at the starting and ending points. Use the DiagramConnector.BeginArrow and DiagramConnector.EndArrow properties to choose arrow styles.

To display text, assign a text string to the DiagramConnector.Content property.

A connector’s bending points are specified by the DiagramConnector.Points collection.

The DevExpress.Diagram.Core.Native.DiagramExtensionsCore.Connectors extension method returns the collection of connectors contained in the diagram. Using this method is more efficient than iterating through the DiagramControl.Items collection.

End-users can customize connectors in the Diagram Designer Control using the Properties Panel.

View Example: Change a Shape's Connection Points at Runtime