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.
Unfortunately, activation email could not send to your email. Please try again.

Binding diagram to dynamic data

Thread ID:





82551 Jun 16,2009 01:14 AM Jun 29,2009 10:49 AM WPF 4
Tags: Diagram
Ron Rais
Asked On June 16, 2009 01:14 AM

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.


Nikhil A [Syncfusion]
Replied On June 16, 2009 08:56 AM

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);

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.


Ron Rais
Replied On June 17, 2009 03:26 AM

Thanks a lot, works perfectly.

James Foster
Replied On June 26, 2009 11:27 AM

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?

Nikhil A [Syncfusion]
Replied On June 29, 2009 10:49 AM

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 .



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.