We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Binding diagram to dynamic data

Hi,
I wanted to ask: Is it possible to bind the diagram to dynamic data through the itemsource property, so that when the data changes the diagram autmaticly displays those changes?

I try to change the data object that is assigned to the diagrams datasource property but no changes appear on the screen.


Thanks!

4 Replies

NA Nikhil A Syncfusion Team June 16, 2009 12:56 PM UTC

Hi Ron,

Thanks for your interest in Syncfusion products.

Yes it is possible to change the data using the ItemsSource property. But once the new data is assigned, the tree needs to be refreshed. This can be done using the RefreshLayout method. The following code can be used to refresh the layout:

diagramModel.ItemsSource = dataobj;
DirectedTreeLayout tree = new DirectedTreeLayout(diagramModel, diagramView);
tree.RefreshLayout();

So once you have assigned your data object, then call the RefreshLayout() method of the corresponding tree-layout you are using(in the example I have used DirectedTreeLayout). This should make your changes get reflected.

Please let us know if you have any concerns.

Regards,
Nikhil.


RR Ron Rais June 17, 2009 07:26 AM UTC

Hi,
Thanks a lot, works perfectly.


JF James Foster June 26, 2009 03:27 PM UTC

Is there any way the diagram can pick up on the fact that it's bound to an observable collection, and automatically refresh whenever the underlying model data changes?



NA Nikhil A Syncfusion Team June 29, 2009 02:49 PM UTC

Hi James,

As mentioned in the previous post, the RefreshLayout() method has to be called when the data changes. Currently, Diagram WPF does not support refreshing the layout by itself . However we will consider providing this support in future releases based on the code compatibility, complexity and product design .

Regards,
Nikhil

Loader.
Live Chat Icon For mobile
Up arrow icon