Hi,
The described problems are different, but both cause containers to lose their children. Let me show this behavior using the attached test project.
1) When I try to add a data object to the list bound to the NodesSource, it appears in the container, but the rest of the objects appear outside. And, accordingly, the further arranging of the container items doesn't make sense. I expect to see the new node appear next to the rest of the items inside the container and will participate in the arranging too. Please click the "Add" button to reproduce this case.
2) The second case is updating the diagram Bounds, which is required when resizing nodes, adding new elements, etc. In ZoomToFit() I calculate and set the ZoomFactor so that the diagram will automatically resize based on the window size. Then I set the size of the diagram to the size of the container node:
Rect bounds = _containerNode.Bounds;
...
Bounds = bounds;
As you can see, the first time it happens correctly. Then, if you press the "Arrange" button, the container will lose some of the nodes. How to make it so that when resizing / adding new diagram elements, this does not happen?
I would be grateful for any advice that will help make it all work correctly. Thanks!
Kostya