Class NodeDefinition
Immutable definition of a node's identity and structure. Contains all properties that define "what" a node is, not "where" it is or its runtime state.
public sealed record NodeDefinition : IEquatable<NodeDefinition>
- Inheritance
-
NodeDefinition
- Implements
- Inherited Members
Remarks
This is a sealed record for value equality and immutability.
Use with expressions to create modified copies:
var renamed = definition with { Label = "New Label" };
Properties
AllowedResizeHandles
Specifies which resize handles should be displayed when this node is selected.
public ResizeHandleMode AllowedResizeHandles { get; init; }
Property Value
Remarks
Default is All (all 8 handles). For nodes with non-rectangular geometry (cylinders, circles, etc.), set this to only show handles that make visual sense.
Data
Custom user data associated with the node. Consider using immutable types for full immutability.
public object? Data { get; init; }
Property Value
GroupPadding
Custom padding around group children when calculating group bounds. Only applies when IsGroup is true. If null, uses the default from settings.
public double? GroupPadding { get; init; }
Property Value
Id
Unique identifier for the node. Required and immutable.
public required string Id { get; init; }
Property Value
Inputs
Input ports for this node (immutable list).
public ImmutableList<PortDefinition> Inputs { get; init; }
Property Value
IsConnectable
Whether this node can have new connections. Default is true.
public bool IsConnectable { get; init; }
Property Value
IsDeletable
Whether this node can be deleted. Default is true.
public bool IsDeletable { get; init; }
Property Value
IsDraggable
Whether this node can be dragged. Default is true.
public bool IsDraggable { get; init; }
Property Value
IsGroup
Whether this node is a group container.
public bool IsGroup { get; init; }
Property Value
IsResizable
Whether this node can be resized. Default is true.
public bool IsResizable { get; init; }
Property Value
IsSelectable
Whether this node can be selected. Default is true.
public bool IsSelectable { get; init; }
Property Value
Label
Optional display label for the node.
public string? Label { get; init; }
Property Value
Outputs
Output ports for this node (immutable list).
public ImmutableList<PortDefinition> Outputs { get; init; }
Property Value
ParentGroupId
The ID of the parent group node, if this node is part of a group.
public string? ParentGroupId { get; init; }
Property Value
Type
The type/category of the node (e.g., "process", "decision", "input"). Used for rendering and validation.
public string Type { get; init; }
Property Value
Methods
AddInput(PortDefinition)
Adds an input port to the definition.
public NodeDefinition AddInput(PortDefinition port)
Parameters
portPortDefinition
Returns
AddOutput(PortDefinition)
Adds an output port to the definition.
public NodeDefinition AddOutput(PortDefinition port)
Parameters
portPortDefinition
Returns
WithPorts(IEnumerable<PortDefinition>?, IEnumerable<PortDefinition>?)
Creates a NodeDefinition with the specified ports using a builder pattern.
public NodeDefinition WithPorts(IEnumerable<PortDefinition>? inputs = null, IEnumerable<PortDefinition>? outputs = null)
Parameters
inputsIEnumerable<PortDefinition>outputsIEnumerable<PortDefinition>