Delete All

How can I programmatically delete all nodes, links, etc from a Diagram?

It’s probably easiest to replace the Diagram.Model with a new empty model.

If you don’t like that idea, you could replace the model’s NodesSource collection with an empty collection (and the LinksSource collection if it’s a GraphLinksModel).

And if you don’t like that idea either, you could replace the whole Diagram with a new one.