Skip to content

Empty

A canvas that starts with no nodes: add them at runtime by appending to the Nodes list, then connect them. OnNodesInitialized reports when what you added has been measured, and NodesInitialized answers the same question later - the cue for any work that needs real node sizes.

0 node(s) · OnNodesInitialized raised 0 time(s)
bit Blow

Try it

  • Press Add node a few times: each node lands at a random spot. Drag from one node's handle to another's to connect them.
  • Watch the toolbar as the first node lands: once it has been measured, OnNodesInitialized fires, the counter goes up and the size the browser measured is shown. Adding more nodes does not raise it again.
  • Press Line up to set the nodes side by side, spaced by their measured widths, and bring the row into view. On an empty canvas it does nothing.
  • Press Clear to empty both lists, then add a node again: the counter goes up a second time.

How it works

  • Nodes and Edges start as empty lists. Adding a BlowNode to the list is all it takes: on its next render the canvas draws the node and measures it, with no Refresh call needed.
  • Without FitViewOnInit the canvas opens at the default viewport - no pan, zoom 1 - so flow position (0, 0) is the pane's top-left corner.
  • OnNodesInitialized is raised when the canvas goes from having nothing measured to every visible node measured. A node added later is measured straight after the render that draws it, so here the event comes once per empty canvas. BlowNode.Measured holds the size, in flow units.
  • NodesInitialized gives the same answer as a property, for code that runs later: Line up checks it before reading Measured.Width, and it is false while the canvas is empty.
  • FitViewAsync with BlowFitViewOptions { MaxZoom = 1, Duration = 300 } eases the row into view without zooming in past full size.
An unhandled error has occurred. Reload 🗙