Version

Configuring the Connection Points of the Diagram Nodes (xamDiagram)

Topic Overview

Purpose

This topic explains how to configure the connection points of diagram nodes in the xamDiagram™ control. This would be necessary if you use custom nodes or need to customize the pre-set connection points of the standard nodes.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic provides an overview of what can be configured about diagram nodes.

This topic explains how to add the xamDiagram control to a WPF application.

Introduction

Connection points configuration summary

Connection points are the points on a node where diagram connections can start/end. A connection point for a node is specified by a name and coordinates.

  • Name – used for explicitly specifying a connection point for a connection through the connection’s StartNodeConnectionPointName/ EndNodeConnectionPointName properties; therefore, all names of connection points for a node should be unique.

  • Coordinates – relative to the node’s rectangle. The coordinates are in the range 0,0 (top-left) to 1,1 (bottom-right).

Each connection point is represented by a DiagramConnectionPoint object exposing Name and Position properties.

When using one of the predefined shape types set through the DiagramNode.ShapeType property, the node’s ConnectionPoints collection is pre-populated with a few points according to the node type. For custom node shapes, no connection points are added by default.

Connection points configuration summary chart

The following table explains briefly the configurable aspects of diagram nodes connection points and maps them to the properties that configure them.

Configurable aspect Details Properties

Custom connection point

Add/remove or modify the points where connections connected to this node will start/end.

Configuring Custom Connection Points for a Node

Overview

Connection points for a node are specified through the ConnectionPoints property. You can use the Add and Remove methods of the DiagramConnectionPointCollection.

Property settings

The following table maps the desired configuration to the property settings that manage it.

In order to: Use this property: And set it to:

Set custom connection points for a node

The desired set of connection points

Example

The following screenshot demonstrates how a node in the xamDiagram would look when its connection point presenters are visible as a result of the code below.

xamDiagram Configuring The Connection Points Of Diagram Nodes 1.png

Following is the code that implements this example.

In XAML:

<ig:XamDiagram x:Name="Diagram">
      <ig:DiagramNode>
            <ig:DiagramNode.ConnectionPoints>
                  <ig:DiagramConnectionPoint Name="Position1" Position="0,0"/>
                  <ig:DiagramConnectionPoint Name="Position2" Position="0.25,0.25"/>
                  <ig:DiagramConnectionPoint Name="Position3" Position="0.5,0.5"/>
                  <ig:DiagramConnectionPoint Name="Position4" Position="0.75,0.75"/>
                  <ig:DiagramConnectionPoint Name="Position5" Position="1,1"/>
            </ig:DiagramNode.ConnectionPoints>
      </ig:DiagramNode>
</ig:XamDiagram>

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic covers the two possible approaches to configuring the start and end points of diagram connections in xamDiagram : by specifying the nodes to connect to or by specifying the coordinates of the connection’s start and end points on the diagram space.

API reference for the XamDiagram.ConnectionPointsDisplayMode property.