Class EdgeDefinition
Immutable definition of an edge's identity and connection structure. Contains all properties that define "what" an edge connects, not its runtime state.
public sealed record EdgeDefinition : IEquatable<EdgeDefinition>
- Inheritance
-
EdgeDefinition
- Implements
- Inherited Members
Remarks
This is a sealed record for value equality and immutability.
Use with expressions to create modified copies:
var reconnected = definition with { Target = "newNodeId" };
Properties
AutoRoute
Whether this edge should use automatic routing to avoid obstacles.
public bool AutoRoute { get; init; }
Property Value
Remarks
This property is maintained for backward compatibility. For new code, prefer using RoutingMode instead. When RoutingMode is explicitly set, it takes precedence.
EffectiveLabel
public string? EffectiveLabel { get; }
Property Value
EffectiveRoutingMode
Gets the effective routing mode, considering both RoutingMode and legacy AutoRoute property.
public EdgeRoutingMode EffectiveRoutingMode { get; }
Property Value
Remarks
If AutoRoute is true and RoutingMode is Auto, obstacle avoidance is enabled. Otherwise, RoutingMode determines behavior.
Id
Unique identifier for the edge. Required and immutable.
public required string Id { get; init; }
Property Value
IsLocked
Whether this edge is locked, preventing deletion and reconnection via UI.
public bool IsLocked { get; init; }
Property Value
Remarks
When true, the edge cannot be deleted or reconnected through user interaction. Programmatic changes are still allowed. Useful for critical connections that should not be accidentally modified.
Label
Optional label to display on the edge.
public string? Label { get; init; }
Property Value
Remarks
For simple labels, use this property directly. For advanced positioning control, use LabelInfo instead. If both are set, LabelInfo takes precedence.
LabelInfo
Enhanced label with positioning information.
public LabelInfo? LabelInfo { get; init; }
Property Value
Remarks
When set, this takes precedence over Label. Use EffectiveLabel to get the resolved label text regardless of which property was set.
MarkerEnd
The marker to display at the end of the edge.
public EdgeMarker MarkerEnd { get; init; }
Property Value
MarkerStart
The marker to display at the start of the edge.
public EdgeMarker MarkerStart { get; init; }
Property Value
RoutingMode
Determines how this edge's path is calculated.
public EdgeRoutingMode RoutingMode { get; init; }
Property Value
Remarks
Source
The ID of the source node.
public required string Source { get; init; }
Property Value
SourcePort
The ID of the source port on the source node.
public required string SourcePort { get; init; }
Property Value
Style
Visual style for the edge including colors, dash patterns, and effects.
public EdgeStyle? Style { get; init; }
Property Value
Remarks
When null, the edge uses theme defaults. Set to customize individual edges or use preset styles like Success or Error.
Target
The ID of the target node.
public required string Target { get; init; }
Property Value
TargetPort
The ID of the target port on the target node.
public required string TargetPort { get; init; }
Property Value
Type
The visual type of the edge (bezier, straight, step, etc.).
public EdgeType Type { get; init; }
Property Value
Methods
ReconnectSource(string, string)
Creates a new definition with a different source node and port.
public EdgeDefinition ReconnectSource(string newSource, string newSourcePort)
Parameters
Returns
ReconnectTarget(string, string)
Creates a new definition with a different target node and port.
public EdgeDefinition ReconnectTarget(string newTarget, string newTargetPort)
Parameters
Returns
WithLabel(string?)
Creates a new definition with a different label.
public EdgeDefinition WithLabel(string? label)
Parameters
labelstring
Returns
WithLabelInfo(LabelInfo?)
Creates a new definition with enhanced label positioning.
public EdgeDefinition WithLabelInfo(LabelInfo? labelInfo)
Parameters
labelInfoLabelInfoThe label info with text and positioning.
Returns
WithLabelInfo(string, LabelAnchor, double, double)
Creates a new definition with enhanced label positioning.
public EdgeDefinition WithLabelInfo(string text, LabelAnchor anchor = LabelAnchor.Center, double offsetX = 0, double offsetY = 0)
Parameters
textstringThe label text.
anchorLabelAnchorWhere along the edge to position the label.
offsetXdoubleHorizontal offset from anchor point.
offsetYdoubleVertical offset from anchor point.
Returns
WithRoutingMode(EdgeRoutingMode)
Creates a new definition with a different routing mode.
public EdgeDefinition WithRoutingMode(EdgeRoutingMode mode)
Parameters
modeEdgeRoutingMode
Returns
WithStyle(EdgeStyle?)
Creates a new definition with a different visual style.
public EdgeDefinition WithStyle(EdgeStyle? style)
Parameters
styleEdgeStyle
Returns
WithType(EdgeType)
Creates a new definition with a different edge type.
public EdgeDefinition WithType(EdgeType type)
Parameters
typeEdgeType