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
close icon

Diagram: Unable to clear diagram

Greetings

I want to replace an existing diagram with a new one based on a new dataset. I'm able to eliminate the nodes, but the connectors remain which confuses the new diagram. I want to know how I can clear out the diagram ready for a new set of data. I've tried the following so far:

   Connectors = new Connector[] { };

   Nodes = new Node[] { };

Also tried setting to null and also tried calling:

   LayoutManager.Layout.UpdateLayout();

However none of this worked, it only clears out the nodes not the connectors. I'm currently running v.11.3.0.30.

Thanks
Garry Mc


3 Replies

RT Ramya Thirugnanam Syncfusion Team September 20, 2013 07:25 AM UTC

Hi Garry,

Sorry about the inconvenience caused.

The reported issue “Connectors Collection does not update visually while reassigning with another collection” is confirmed as a defect and we have logged an issue report to fix this. This fix will be available in our upcoming WinRT service pack release.

Workaround:
 
Instead of using array, please use ObservableCollection<T> for populating the Nodes and Connector properties of SfDiagram.it will resolve the issue with clearing Connector Collection by using Clear () method before assigning new set of data.

We have created a simple sample to represent this workaround. Please refer to the sample from the attachment.

Please let us know if you need any further assistance.
Regards,
Ramya



112396_3f8dc6c3.zip


GM Garry Mc September 20, 2013 05:23 PM UTC

Thanks for the prompt turn around!! The workaround has solved my issue, so many thanks!


SideNote

I have found that the documentation for the Diagram control is somewhat lacking. As an example, I see there's a ViewModel option however I don't see ANY documentation on how its to be used. The control has a lot of potential but with the lack of documentation its hard to take advantage of.




RT Ramya Thirugnanam Syncfusion Team September 23, 2013 11:44 AM UTC

Hi Garry,

Thank you for the feedback.

We have a set of ViewModel classes, but these are classes just implemented from corresponding interfaces (Example: NodeViewModel implemented INode). Except for INotifyPropertyChanged, these classes do not have any logic/implementation. These are just utility classes, just to reduce the time/work of creating a new one in application side for customers.

All kind of objects Views (Node), ViewModels (NodeViewModel), Interfaces (INode) have the same set of properties, so it is not necessary to explain separately for each kind.

A detailed explanation about adding and rendering a UI and Non-UI element and explained in the below link. Here we have explained how to use ViewModel and how corresponding views are created, and how can you override with custom views. Please refer to the link.

Link: http://help.syncfusion.com/UG/winrt/Documents/rendering.htm

Please let us know if you need any further assistance.
Regards,
Ramya


Loader.
Live Chat Icon For mobile
Up arrow icon