Table of Contents

Class SelectionManager

Namespace
FlowGraph.Avalonia
Assembly
FlowGraph.Avalonia.dll

Manages selection state for nodes and edges in the flow canvas.

public class SelectionManager
Inheritance
SelectionManager
Inherited Members

Constructors

SelectionManager(IGraphContext, Func<CanvasElementManager>, Func<ThemeResources>, CommandHistory)

Creates a new selection manager.

public SelectionManager(IGraphContext context, Func<CanvasElementManager> getRenderer, Func<ThemeResources> getTheme, CommandHistory commandHistory)

Parameters

context IGraphContext

The graph context providing access to the current graph.

getRenderer Func<CanvasElementManager>

Function to get the graph renderer.

getTheme Func<ThemeResources>

Function to get the current theme.

commandHistory CommandHistory

The command history for undo/redo support.

SelectionManager(Func<Graph?>, Func<CanvasElementManager>, Func<ThemeResources>, CommandHistory)

[Obsolete("Use the constructor that accepts IGraphContext instead.")]
public SelectionManager(Func<Graph?> getGraph, Func<CanvasElementManager> getRenderer, Func<ThemeResources> getTheme, CommandHistory commandHistory)

Parameters

getGraph Func<Graph>
getRenderer Func<CanvasElementManager>
getTheme Func<ThemeResources>
commandHistory CommandHistory

Properties

HasSelection

Gets whether any items are selected.

public bool HasSelection { get; }

Property Value

bool

Methods

DeleteSelected()

Deletes all selected nodes, edges, and shapes.

public void DeleteSelected()

DeselectAll()

Deselects all nodes, edges, and shapes.

public void DeselectAll()

GetSelectedEdges()

Gets all selected edges.

public IEnumerable<Edge> GetSelectedEdges()

Returns

IEnumerable<Edge>

GetSelectedNodes()

Gets all selected nodes.

public IEnumerable<Node> GetSelectedNodes()

Returns

IEnumerable<Node>

GetSelectedShapes()

Gets all selected shapes.

public IEnumerable<ShapeElement> GetSelectedShapes()

Returns

IEnumerable<ShapeElement>

HandleEdgeClicked(Edge, bool)

Handles edge click to update selection state.

public void HandleEdgeClicked(Edge clickedEdge, bool ctrlHeld)

Parameters

clickedEdge Edge
ctrlHeld bool

NotifySelectionMayHaveChanged()

Notifies that the selection may have changed (called by external code).

public void NotifySelectionMayHaveChanged()

SelectAll()

Selects all selectable elements (nodes, edges, and shapes) in the graph.

public void SelectAll()

Events

EdgeRerenderRequested

Event raised when edges need to be re-rendered after selection changes.

public event EventHandler? EdgeRerenderRequested

Event Type

EventHandler

SelectionChanged

Event raised when the selection changes.

public event EventHandler<SelectionChangedEventArgs>? SelectionChanged

Event Type

EventHandler<SelectionChangedEventArgs>