LinkingTool

StockSharp.Xaml.Diagram.GXDiagram.Tool

The LinkingTool lets a user draw a new Link between two ports, using a mouse-drag operation.

Inherits: LinkingBaseTool

Properties

Direction
public LinkingDirection Direction { get; set; }
value = linkingTool.Direction
linkingTool.Direction = value

Gets or sets the direction in which new links may be drawn.

StartElement
public FrameworkElement StartElement { get; set; }
value = linkingTool.StartElement
linkingTool.StartElement = value

Gets or sets the FrameworkElement at which FindLinkablePort should start its search.

StartPort
protected FrameworkElement StartPort { get; set; }
value = linkingTool.StartPort
linkingTool.StartPort = value

Gets or sets the port element at which the linking operation started.

Methods

CanStart
public override bool CanStart()
result = linkingTool.CanStart()

This tool can run when the diagram allows linking, the model is modifiable, the left-button mouse drag has moved far enough away to not be click, and when FindLinkablePort has returned a valid port.

DoActivate
public override void DoActivate()
linkingTool.DoActivate()

Start the linking operation.

DoDeactivate
public override void DoDeactivate()
linkingTool.DoDeactivate()

Finishing the linking operation stops the model edit and resets the cursor.

DoMouseUp
public override void DoMouseUp()
linkingTool.DoMouseUp()

A mouse-up ends the linking operation; if there is a valid TargetPort nearby, this calls Object) to create a new link.

DoStop
public override void DoStop()
linkingTool.DoStop()

Clean up tool state.

FindLinkablePort
protected virtual FrameworkElement FindLinkablePort()
result = linkingTool.FindLinkablePort()

Return the element at the mouse-down point, if it is part of a node and if it is valid to link with it.

Returns: If the Direction is Either or ForwardsOnly, this checks the element and its parent Node by calling FrameworkElement). If the Direction is Either or BackwardsOnly, this checks the element and its parent Node by calling FrameworkElement). In either case finding a matching port will return that port and set Forwards in the appropriate direction. Otherwise this will return null.

Fields

DirectionProperty
public static readonly DependencyProperty DirectionProperty
value = LinkingTool.DirectionProperty

Identifies the Direction dependency property.