-
-
Notifications
You must be signed in to change notification settings - Fork 230
Connections Overview
Connections are created between two points. The Source
and Target
dependency properties are of type Point
and are usually bound to a connector's Anchor
point.
- Base connection
- Line connection
- Circuit connection
- Bezier connection
- Step connection
- Pending connection
The base class for all connections provided by the library is BaseConnection
which derives from Shape
. There's no restriction to derive from BaseConnection
when you create a custom connection.
It exposes two commands with their corresponding events:
-
DisconnectCommand
, respectivelyDisconnectEvent
- fired when the connection is clicked while holdingALT
-
SplitCommand
, respectivelySplitEvent
- fired when the connection is double-clicked
The Direction
of a connection can have two values:
Forward
Backward
The SourceOffset
and the TargetOffset
work together with OffsetMode
and will keep a distance from the anchor point:
Connections also have a Spacing
which will make the connection break the angle at a certain distance from the Source
and Target
points:
- With spacing:
- Without spacing:
Settings the ArrowSize
to "0, 0" will remove the arrowhead.
A straight line from Source
to Target
.
It has an Angle
dependency property to control where it breaks. Angle is in degrees.
A bezier curve between Source
and Target
.
A multi-segment angled wire between Source
and Target
. It has two additional parameters: SourcePosition
and TargetPosition
.
A pending connection can be created from a connector and dropped on either an ItemContainer
(if AllowOnlyConnectors
is false) or a Connector
.
Content
of a pending connection can be customized using the ContentTemplate
. If EnablePreview
is true, the PreviewTarget
will be updated with the connector or item container under the mouse cursor or null
if there's no such element.
The visibility of pending connections can be controlled using the IsVisible
dependency property.
Connection snapping to connectors can be enabled using the EnableSnapping
dependency property.
The Source
and the Target
properties are data contexts of connectors and the Target
will be updated when the pending connection is completed.
There's also a StartedCommand
which takes the Source
as the parameter, respectively a CompletedCommand
which takes the Target
as the parameter.
Tip
Canceling a pending connection is done by releasing the right mouse button.