Hi,
ContainerNodes just group other elements of same parent diagram, so whatever you add to a container must be added to the diagram indeed.
Quote:1.I saw that Add calls AttachTo under the hood. What does Add what AttachTo doesn't do? Wich one shall I use?
There'll be some difference if you fold the container - attached nodes won't hide but added one will do. We plan to re-implement containers without using groups soon, so Add won't use AttachTo then anyway.
Quote:2.Is it the best idea to have diagramA hosting all descendant "diagrams", nodes and links? I can see one benefit of that: Given MouseInputMode.HandledByDiagram, a event handler for e.g. NodeModified can easily delegate the work to the right DiagramNode.
From our side it's much easier if the diagram has direct access to all nodes including children in containers, especially in situations such as links connecting nodes from different containers, moving child nodes between containers, etc. Maybe you could implement true nesting by showing a child Diagram inside DiagramNodeAdapter inside the parent Diagram, as long as you don't need to draw links between nodes of child diagrams, and doing some re-parenting of child nodes when moving between containers.
Quote:3.Is there a chance to get relative positions when e.g. NodeModified or LinkModified is fired? Or do I have to convert the data myself?
There's the TransformDiagramToItem method you could use to transform a child node's position to container-relative one:
void OnContainerChildAdded(object sender, ContainerChildEventArgs e)
{
var diagramPos = e.Node.Bounds.Location;
var localPos = e.Container.TransformDiagramToItem(diagramPos);
Debug.WriteLine("diagram: " + diagramPos);
Debug.WriteLine("local: " + localPos);
}
Regards,
Slavcho
Mindfusion