Node focus

How can I set the focus on the last created node. Lets say that I create a node by selecting a node and pressing a button and that I want to be able to select the recently created node and just press the same button so that I can create a string of nodes without having to manually select the last node to create a new node.

Take a look at the State Chart sample, which does just that when the user clicks the button that appears when the user selects a node.

However, I think we need to change the sample so that it tries to scroll the diagram to show the new node only after the transaction completes, since only then will the new diagram bounds have been computed and the scroll bar updated so that it physically can scroll to show the new node.

myDiagram.Panel.MakeVisible(newnode, Rect.Empty);
with: EventHandler show = null;
show = (snd, evt) => {
myDiagram.Panel.MakeVisible(newnode, Rect.Empty);
myDiagram.LayoutCompleted -= show;
myDiagram.LayoutCompleted += show;

Great! That works, Thanks