Diagram Dispatcher.BeginInvoke Render Issue 8.4.0.10

Hi,

Referring to the Organization Chart Demo, when I use "createNodes()" in windows loaded event with many nodes, the UI takes a while to complete.

So I tried an alternative way by using Dispatcher.BeginInvoke in the windows loaded event and the diagram do not render properly.


private delegate void LoadNodesDelegate();
Dispatcher.BeginInvoke(DispatcherPriority.Background, new LoadNodesDelegate(createNodes));

Is there any way to fix this?

Thanks


2 Replies

SM Sundar M Syncfusion Team December 28, 2010 09:56 AM UTC

Hi Shimaz,

Regarding the Diagram is not rendered properly, when the nodes are created in Dispatcher’s Background the Tree layout will not be updated automatically, so please update the tree layout after Nodes are created as shown in the code snippet. For more details please refer the sample from the following link :

Sample link : https://s3.amazonaws.com/files2.syncfusion.com/Support/Diagram%20WPF%20&%20SL/Sample/ForumUpdate/CreateNodes.zip

Code Snippet :

// update the DiagramView's layout
diagramView.UpdateLayout();
DirectedTreeLayout tree = new DirectedTreeLayout(diagramModel, diagramView);
// Refresh the DirectedTreeLayout
tree.RefreshLayout();


Here diagramView is an instance of DiagramView.

Please let us know if you have any queries.

Regards,
Sundar M.



AS ashimaz December 28, 2010 01:47 PM UTC

Thank you, that works perfectly.


Loader.
Up arrow icon