J.
J.Nagarajan
Syncfusion Team
September 4, 2008 11:56 AM UTC
Hi
Thanks for your interest in Syncfusion products.
You have to handle PreferredLayout event of the DirectedTreeLayoutManager and use the location property of that eventargs. Please refer to the below code snippet.
DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
dtlm.PreferredLayout += new PreferredLayoutEventHandler(dtlm_PreferredLayout);
this.diagram1.LayoutManager.UpdateLayout( null );
void dtlm_PreferredLayout(object sender, PreferredLayoutEventArgs evtArgs)
{
evtArgs.Location = new PointF(150, 120);
}
Please let me if this helps.
Thanks,
Nagaraj
SA
Sash
September 8, 2008 07:02 PM UTC
Thanks this helps. I would like to know if there is a similar event for new child nodes created programatically. Ideally i would like new nodes to be somewhere close to its parent node..but they get added at position (0,0).
>Hi
Thanks for your interest in Syncfusion products.
You have to handle PreferredLayout event of the DirectedTreeLayoutManager and use the location property of that eventargs. Please refer to the below code snippet.
DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
dtlm.PreferredLayout += new PreferredLayoutEventHandler(dtlm_PreferredLayout);
this.diagram1.LayoutManager.UpdateLayout( null );
void dtlm_PreferredLayout(object sender, PreferredLayoutEventArgs evtArgs)
{
evtArgs.Location = new PointF(150, 120);
}
Please let me if this helps.
Thanks,
Nagaraj
J.
J.Nagarajan
Syncfusion Team
September 10, 2008 05:51 AM UTC
Hi Sash ,
Model.EventSink.NodeCollectionChanging event gets fired when a new node is created in the diagram model. If you want to layout that new child node, then please set AutoLayout property of the LayoutManager to true.
//NodeCollectionChanging event
this.diagram1.Model.EventSink.NodeCollectionChanging += new CollectionExEventHandler(EventSink_NodeCollectionChanging);
void EventSink_NodeCollectionChanging(CollectionExEventArgs evtArgs)
{
}
// To layout that new child node
DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
dtlm.AutoLayout = true;
this.diagram1.LayoutManager.UpdateLayout( null );
Please let me know if this helps.
Thanks,
Nagaraj
SA
Sash
October 14, 2008 11:25 PM UTC
If my diagram has only one node...PreferredLayoutEventHandler has no effect. How do i place my first node in an appropriate position.
>Hi
Thanks for your interest in Syncfusion products.
You have to handle PreferredLayout event of the DirectedTreeLayoutManager and use the location property of that eventargs. Please refer to the below code snippet.
DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
dtlm.PreferredLayout += new PreferredLayoutEventHandler(dtlm_PreferredLayout);
this.diagram1.LayoutManager.UpdateLayout( null );
void dtlm_PreferredLayout(object sender, PreferredLayoutEventArgs evtArgs)
{
evtArgs.Location = new PointF(150, 120);
}
Please let me if this helps.
Thanks,
Nagaraj
AD
Administrator
Syncfusion Team
November 6, 2008 05:44 AM UTC
Hi
Thanks for your interest in Syncfusion products.
The PreferredLayoutEventHandler position the nodes only when we have connection between nodes. if diagram has only one node they don't postion the appropriate location.
If you need to place a first node in appropriate location, Please refer to the below code snippet.
RoundRect rect = new RoundRect(150,100, 50, 50, MeasureUnits.Pixel);
this.diagram1.Model.AppendChild(rect);
DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
this.diagram1.LayoutManager.UpdateLayout( null );
Please let me know if this helps.
Thanks,
Ramesh M
AD
Administrator
Syncfusion Team
November 6, 2008 05:47 AM UTC
Hi
Thanks for your interest in Syncfusion products.
Remove the below line you will get the first node position in approptiate location.
//this.diagram1.LayoutManager.UpdateLayout( null );
Please let me know if this helps.
Thanks,
Ramesh M