Table of Contents

Class GroupManager

Namespace
FlowGraph.Avalonia
Assembly
FlowGraph.Avalonia.dll

Manages group operations including auto-sizing, collapse state, and drag-to-add.

public class GroupManager
Inheritance
GroupManager
Inherited Members

Constructors

GroupManager(IGraphContext, CommandHistory, FlowCanvasSettings)

Creates a new group manager.

public GroupManager(IGraphContext context, CommandHistory commandHistory, FlowCanvasSettings settings)

Parameters

context IGraphContext

The graph context providing access to the current graph.

commandHistory CommandHistory

The command history for undo/redo support.

settings FlowCanvasSettings

The canvas settings.

GroupManager(Func<Graph?>, CommandHistory, FlowCanvasSettings)

[Obsolete("Use the constructor that accepts IGraphContext instead.")]
public GroupManager(Func<Graph?> getGraph, CommandHistory commandHistory, FlowCanvasSettings settings)

Parameters

getGraph Func<Graph>
commandHistory CommandHistory
settings FlowCanvasSettings

Properties

GroupPadding

Padding around children when calculating group bounds.

public double GroupPadding { get; set; }

Property Value

double

HeaderHeight

Height of the group header.

public double HeaderHeight { get; set; }

Property Value

double

Methods

AddNodesToGroup(string, IEnumerable<string>)

Adds nodes to an existing group.

public void AddNodesToGroup(string groupId, IEnumerable<string> nodeIds)

Parameters

groupId string
nodeIds IEnumerable<string>

AutoResizeGroup(string)

Auto-resizes a group to fit its children with padding.

public void AutoResizeGroup(string groupId)

Parameters

groupId string

CollapseAll()

Collapses all groups in the graph.

public void CollapseAll()

CreateGroup(IEnumerable<string>, string?)

Creates a group from the specified nodes.

public Node? CreateGroup(IEnumerable<string> nodeIds, string? label = null)

Parameters

nodeIds IEnumerable<string>
label string

Returns

Node

ExpandAll()

Expands all groups in the graph.

public void ExpandAll()

GetAllGroups()

Gets all groups in the graph.

public IEnumerable<Node> GetAllGroups()

Returns

IEnumerable<Node>

GetGroupAtPoint(Point)

Checks if a point is inside a group's drop zone.

public string? GetGroupAtPoint(Point canvasPoint)

Parameters

canvasPoint Point

Returns

string

GetGroupChildren(string)

Gets the children of a group.

public IEnumerable<Node> GetGroupChildren(string groupId)

Parameters

groupId string

Returns

IEnumerable<Node>

GetVisibleEdges()

Gets all visible edges (excluding those with hidden endpoints).

public IEnumerable<Edge> GetVisibleEdges()

Returns

IEnumerable<Edge>

GetVisibleNodes()

Gets all visible nodes (excluding those hidden by collapsed groups).

public IEnumerable<Node> GetVisibleNodes()

Returns

IEnumerable<Node>

HandleNodeDroppedOnGroup(IEnumerable<string>, Point)

Handles dropping nodes onto a group.

public bool HandleNodeDroppedOnGroup(IEnumerable<string> nodeIds, Point dropPoint)

Parameters

nodeIds IEnumerable<string>
dropPoint Point

Returns

bool

IsNodeVisible(string)

Checks if a node is visible (not hidden by a collapsed parent group).

public bool IsNodeVisible(string nodeId)

Parameters

nodeId string

Returns

bool

RemoveNodesFromGroup(IEnumerable<string>)

Removes nodes from their parent group.

public void RemoveNodesFromGroup(IEnumerable<string> nodeIds)

Parameters

nodeIds IEnumerable<string>

SetCollapsed(string, bool)

Sets the collapsed state of a group.

public void SetCollapsed(string groupId, bool collapsed)

Parameters

groupId string
collapsed bool

ToggleCollapse(string)

Toggles the collapsed state of a group.

public void ToggleCollapse(string groupId)

Parameters

groupId string

Ungroup(string)

Ungroups the specified group.

public void Ungroup(string groupId)

Parameters

groupId string

Events

GroupCollapsedChanged

Event raised when a group's collapsed state changes.

public event EventHandler<GroupCollapsedEventArgs>? GroupCollapsedChanged

Event Type

EventHandler<GroupCollapsedEventArgs>

GroupRerenderRequested

Event raised when a group needs to be re-rendered.

public event EventHandler<string>? GroupRerenderRequested

Event Type

EventHandler<string>

NodesAddedToGroup

Event raised when nodes are added to a group.

public event EventHandler<NodesAddedToGroupEventArgs>? NodesAddedToGroup

Event Type

EventHandler<NodesAddedToGroupEventArgs>