Connector
Connector Class
Section titled “Connector Class”Namespace: Nodify
Assembly: Nodify
Inheritance: Object → DispatcherObject → DependencyObject → Visual → UIElement → FrameworkElement → Control → Connector
Derived: NodeInput, NodeOutput, StateNode
References: ConnectorState.Connecting, Connection, ConnectorEventArgs, ConnectorEventHandler, ConnectorState.Default, ConnectorState.Disconnect, InputProcessor, ItemContainer, KnotNode, Node, NodifyEditor, PendingConnection, PendingConnectionEventArgs, PendingConnectionEventHandler
Represents a connector control that can start and complete a PendingConnection. Has a Connector.ElementConnector that the Connector.Anchor is calculated from for the PendingConnection. Center of this control is used if missing.
public class Connector : Control
Constructors
Section titled “Constructors”Connector()
Section titled “Connector()”public Connector();
Fields
Section titled “Fields”ElementConnector
Section titled “ElementConnector”protected const string ElementConnector = "PART_Connector";
Field Value
EnableOptimizations
Section titled “EnableOptimizations”Gets or sets if Connectors should enable optimizations based on Connector.OptimizeSafeZone and Connector.OptimizeMinimumSelectedItems.
public static bool EnableOptimizations;
Field Value
OptimizeMinimumSelectedItems
Section titled “OptimizeMinimumSelectedItems”Gets or sets the minimum selected items needed to trigger optimizations when outside of the Connector.OptimizeSafeZone.
public static uint OptimizeMinimumSelectedItems;
Field Value
OptimizeSafeZone
Section titled “OptimizeSafeZone”Gets or sets the safe zone outside the editor’s viewport that will not trigger optimizations.
public static double OptimizeSafeZone;
Field Value
Properties
Section titled “Properties”AllowPendingConnectionCancellation
Section titled “AllowPendingConnectionCancellation”Gets or sets whether cancelling a pending connection is allowed.
public static bool AllowPendingConnectionCancellation { get; set; }
Property Value
Anchor
Section titled “Anchor”Gets the location in graph space coordinates where Connections can be attached to. Bind with System.Windows.Data.BindingMode.OneWayToSource
public Point Anchor { get; set; }
Property Value
Container
Section titled “Container”Gets the ItemContainer that contains this Connector.
public ItemContainer Container { get; set; }
Property Value
DisconnectCommand
Section titled “DisconnectCommand”Invoked if the Connector.Disconnect event is not handled. Parameter is the FrameworkElement.DataContext of this control.
public ICommand DisconnectCommand { get; set; }
Property Value
Editor
Section titled “Editor”Gets the NodifyEditor that owns this Connector.Container.
public NodifyEditor Editor { get; set; }
Property Value
HasContextMenu
Section titled “HasContextMenu”Gets a value indicating whether the connector has a context menu.
public bool HasContextMenu { get; set; }
Property Value
HasCustomContextMenu
Section titled “HasCustomContextMenu”Gets or sets a value indicating whether the connector uses a custom context menu.
public bool HasCustomContextMenu { get; set; }
Property Value
InputProcessor
Section titled “InputProcessor”protected InputProcessor InputProcessor { get; set; }
Property Value
IsConnected
Section titled “IsConnected”If this is set to false, the Connector.Disconnect event will not be invoked and the connector will stop updating its Connector.Anchor when moved, resized etc.
public bool IsConnected { get; set; }
Property Value
IsPendingConnection
Section titled “IsPendingConnection”Gets a value that indicates whether a PendingConnection is in progress for this Connector.
public bool IsPendingConnection { get; protected set; }
Property Value
Methods
Section titled “Methods”BeginConnecting()
Section titled “BeginConnecting()”Initiates a new pending connection from this connector with the specified offset (see Connector.IsPendingConnection).
public void BeginConnecting();
BeginConnecting(Vector)
Section titled “BeginConnecting(Vector)”public void BeginConnecting(Vector offset);
Parameters
offset
Vector
CancelConnecting()
Section titled “CancelConnecting()”Cancels the current pending connection without completing it if Connector.AllowPendingConnectionCancellation is true. Otherwise, it completes the pending connection by calling Nodify.Connector.EndConnecting.
public void CancelConnecting();
EndConnecting()
Section titled “EndConnecting()”Completes the current pending connection using the specified connector as the target.
public void EndConnecting();
EndConnecting(Connector)
Section titled “EndConnecting(Connector)”public void EndConnecting(Connector connector);
Parameters
connector
Connector
FindConnectionTarget(Point)
Section titled “FindConnectionTarget(Point)”Searches for a potential Connector or ItemContainer at the specified position within the editor.
public FrameworkElement FindConnectionTarget(Point position);
Parameters
position
Point: The position in the editor to check for a potential connection target.
Returns
FindTargetConnector(Point)
Section titled “FindTargetConnector(Point)”Searches for a Connector at the specified position.
public Connector FindTargetConnector(Point position);
Parameters
position
Point: The position in the editor to check for a connector.
Returns
OnApplyTemplate()
Section titled “OnApplyTemplate()”public override void OnApplyTemplate();
OnKeyDown(KeyEventArgs)
Section titled “OnKeyDown(KeyEventArgs)”protected override void OnKeyDown(KeyEventArgs e);
Parameters
OnKeyUp(KeyEventArgs)
Section titled “OnKeyUp(KeyEventArgs)”protected override void OnKeyUp(KeyEventArgs e);
Parameters
OnLostMouseCapture(MouseEventArgs)
Section titled “OnLostMouseCapture(MouseEventArgs)”protected override void OnLostMouseCapture(MouseEventArgs e);
Parameters
OnMouseDown(MouseButtonEventArgs)
Section titled “OnMouseDown(MouseButtonEventArgs)”protected override void OnMouseDown(MouseButtonEventArgs e);
Parameters
OnMouseMove(MouseEventArgs)
Section titled “OnMouseMove(MouseEventArgs)”protected override void OnMouseMove(MouseEventArgs e);
Parameters
OnMouseUp(MouseButtonEventArgs)
Section titled “OnMouseUp(MouseButtonEventArgs)”protected override void OnMouseUp(MouseButtonEventArgs e);
Parameters
OnMouseWheel(MouseWheelEventArgs)
Section titled “OnMouseWheel(MouseWheelEventArgs)”protected override void OnMouseWheel(MouseWheelEventArgs e);
Parameters
OnRenderSizeChanged(SizeChangedInfo)
Section titled “OnRenderSizeChanged(SizeChangedInfo)”protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo);
Parameters
sizeInfo
SizeChangedInfo
RemoveConnections()
Section titled “RemoveConnections()”Removes all connections associated with this connector.
public void RemoveConnections();
UpdateAnchor(Point)
Section titled “UpdateAnchor(Point)”Updates the Connector.Anchor relative to a location. (usually Connector.Container’s location)
protected void UpdateAnchor(Point location);
Parameters
location
Point: The relative location
UpdateAnchor()
Section titled “UpdateAnchor()”Updates the Connector.Anchor based on Connector.Container’s location.
public void UpdateAnchor();
UpdateAnchorOptimized(Point)
Section titled “UpdateAnchorOptimized(Point)”Updates the Connector.Anchor and applies optimizations if needed based on Connector.EnableOptimizations flag
protected void UpdateAnchorOptimized(Point location);
Parameters
location
Point
UpdatePendingConnection(Vector)
Section titled “UpdatePendingConnection(Vector)”Updates the endpoint of the pending connection by adjusting its position with the specified offset.
public void UpdatePendingConnection(Vector offset);
Parameters
offset
Vector: The amount to adjust the pending connection’s endpoint.
UpdatePendingConnection(Point)
Section titled “UpdatePendingConnection(Point)”Updates the endpoint of the pending connection to the specified position.
public void UpdatePendingConnection(Point position);
Parameters
position
Point: The new position for the connection’s endpoint.
Events
Section titled “Events”Disconnect
Section titled “Disconnect”Triggered by the Nodify.Interactivity.EditorGestures.ConnectorGestures.Disconnect gesture.
public event ConnectorEventHandler Disconnect;
Event Type
PendingConnectionCompleted
Section titled “PendingConnectionCompleted”Triggered by the Nodify.Interactivity.EditorGestures.ConnectorGestures.Connect gesture.
public event PendingConnectionEventHandler PendingConnectionCompleted;
Event Type
PendingConnectionDrag
Section titled “PendingConnectionDrag”Occurs when the mouse is changing position and the Connector has mouse capture.
public event PendingConnectionEventHandler PendingConnectionDrag;
Event Type
PendingConnectionStarted
Section titled “PendingConnectionStarted”Triggered by the Nodify.Interactivity.EditorGestures.ConnectorGestures.Connect gesture.
public event PendingConnectionEventHandler PendingConnectionStarted;
Event Type