Right now I have the above diagram. Right now Whenever I add a new node it is positioned automatically on the screen. I want the position to be exactly there where user has droped that node. Example diagram that matches the scenario is
What is happening is that when the user adds a node, the Diagram.Layout is invalidated and that layout is performed again, thereby moving the node (and all of the other nodes) according to the layout’s implementation.
If you don’t want to automatically invalidate the layout when a node is added, you can set DiagramLayout.Conditions to be whatever combination of LayoutChange flags that you want. There are examples of setting Conditions="…" in many of the samples in the Demo.
If there’s no link between those two nodes, LayeredDigraphLayout will put those two nodes in the same layer, which (when Direction==90) means horizontally next to each other.
Do you have a TwoWay Binding on Node.Location to some data property? If so, you can initialize the location of those two nodes in your data. You would also need to set LayeredDigraphLayout.Conditions=“None”. This would mean no automatic layout. Presumably you would offer a button or other command for the user to decide when they wanted an explicit layout.
Then when you are loading the model you can see if all of the nodes already have positions. If they do, everything is OK. If some don’t, then you can call Diagram.LayoutDiagram().