Skip to content

Selection Change

OnSelectionChange reports the selected nodes and edges whenever the set really changes - by a click, a box, a key or your own code - so the page can show or act on it. SelectAsync changes the selection from code and raises it too.

Node 1
Node 2
Node 3
Node 4
selected nodes: -
selected edges: -
OnSelectionChange raised 0 times
bit Blow

Try it

  • Click a node or an edge: the panel lists it. Shift+click adds to the selection, and clicking the background clears it.
  • Drag across the empty background to draw a selection box: on this page a plain drag selects, so hold Space while dragging to pan instead.
  • Click the node that is already selected: nothing changed, so the count in the panel stays where it was.
  • Press Ctrl+A (Cmd+A) with the canvas focused to select everything, and Escape to clear.
  • Select input and output replaces the selection from code; Add node 2's edges adds to whatever is selected; Clear empties it. Each one updates the panel.
  • Set node 3's Selected flips the flag directly: node 3 is drawn selected, but no event is raised, so the panel does not hear of it.

How it works

  • OnSelectionChange receives a BlowSelectionChange whose Nodes and Edges are the full current selection. It is raised only when the selected set really differs from the last one reported, so handling it is cheap.
  • SelectionOnDrag="true" makes a plain drag on the pane draw the box; PanActivationKey (Space) held turns the drag back into a pan.
  • SelectAsync(nodes, edges) makes those elements the selection; with additive: true it adds them instead, and called with nothing it clears. Elements that are hidden or have Selectable = false are passed over.
  • Setting BlowNode.Selected or BlowEdge.Selected yourself changes what is drawn but raises no OnSelectionChange - use SelectAsync when listeners should know.
  • Ctrl/Cmd+A comes from SelectAllKeyEnabled (on by default) and calls the same SelectAllAsync() an app can call itself.
An unhandled error has occurred. Reload 🗙