Search
DiagramLink Class
Remarks See Also
 





Represents a link between two diagram nodes.

Namespace: MindFusion.Diagramming.Wpf
Assembly: MindFusion.Diagramming.Wpf

 Syntax

C#  Copy Code

public class DiagramLink : DiagramItem,
    Routable, IAnimationItem

Visual Basic  Copy Code

Public Class DiagramLink
    Inherits DiagramItem
    Implements Routable, IAnimationItem

 Remarks

Links between nodes in WpfDiagram diagrams are represented by instances of the DiagramLink class. Links connect at most two nodes, which can be accessed through the Origin and Destination properties. If connected to node anchor points, the point indices can be accessed using the OriginAnchor and DestinationAnchor properties. To control whether users are allowed to move link end points, set AllowMoveStart and AllowMoveEnd.

Links are built of smaller parts called segments, which can be straight lines, cascading orthogonal lines or Bézier curves. The type of segments is set through the Shape property. The number of link's segments is specified by the SegmentCount property. Access to control point locations is provided by the ControlPoints collection.

Usually, only the first and last segments of a link are updated if the nodes it connects are moved around. Number, orientation and/or position of link segments can change dynamically in various ways depending on the values of AutoRoute, Dynamic and RetainForm. For links with a Cascading shape, the CascadeOrientation property specifies the orientation of their first segments.

If AutoSnapToNode is enabled, a link automatically aligns its end points to the border of the origin or destination nodes when a user moves the first or last control points. This has a higher priority than aligning to the grid, but a lower priority than aligning to an anchor point.

Links can display distinct arrowhead shapes at their ends. These shapes can be set with the HeadShape and BaseShape properties. The size of the base and arrowhead images is specified by the HeadShapeSize and BaseShapeSize properties. Arrowhead shapes can be displayed in the middle of each segment to facilitate users by distinguishing different links. The type and size of these shapes is set with the IntermediateShape and IntermediateShapeSize properties.

Arowhead borders are painted using HeadStroke and HeadStrokeThickness attributes (or the legacy HeadPen pen). Respective shape types are filled using HeadBrush, BaseBrush and IntermediateBrush properties. If they are not set, the base item Brush property is applied instead.

The color of link segments can be specified using the Stroke property, and their thickness by setting StrokeThickness. The appearance of link's selection handles can be changed using HandlesStyle.

Links can have some text associated with them, displayed as specified by the Text, TextBrush and TextStyle properties. The AddLabel method allows displaying multiple labels per link. Labels can automatically avoid overlapping nodes or other labels when their AutoArrange property is set.

Bounds and Length are informative properties returning respectively link's location and total length.

 Inheritance Hierarchy

System.Object
    System.Windows.Threading.DispatcherObject
        System.Windows.DependencyObject
            System.Windows.Media.Visual
                System.Windows.UIElement
                    System.Windows.FrameworkElement
                        MindFusion.Diagramming.Wpf.DiagramItem
                            MindFusion.Diagramming.Wpf.DiagramLink

 See Also