Stoyo wrote on Apr 15
th, 2010 at 10:50am:
Do you need to move the tree to a container programmatically? It should look like this:
foreach (DiagramNode node in treeNodes)
container.Add(node);
Stoyan
I do exactly like you said, but the result is not one that I expect. That's my code:
ContainerNode container = new ContainerNode( diagram1 );
ShapeNode s1 = new ShapeNode( diagram1 );
ShapeNode s2 = new ShapeNode( diagram1 );
DiagramLink link = new DiagramLink( diagram1, s1, s2 );
diagram1.Nodes.Add( s1 );
diagram1.Nodes.Add( s2 );
diagram1.Links.Add( link );
diagram1.Nodes.Add( container );
DiagramItemCollection arrange = new DiagramItemCollection { s1, s2 };
TreeLayout treeLayout = new TreeLayout( s1, TreeLayoutType.Centered );
treeLayout.Arrange( diagram1, arrange );
container.Add( s1 );
container.Add( s2 );
container.UpdateBounds( true );
GridLayout gridLayout = new GridLayout();
gridLayout.Arrange( diagram1 );