This is a migrated thread and some comments may be shown as answers.

Connections don't get removed when node is deleted

1 Answer 133 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 31 May 2017, 06:37 AM

I have a MVVM setup with GraphSource etc. as described in this example: http://docs.telerik.com/devtools/wpf/controls/raddiagram/populating-with-data/data-databinding

When I delete a node, the connecting edges are not getting deleted. I see this working in various other examples, but for me, the edges remain on the diagram. I found an old post from 2013 about this functionality not working, but I expect that in 2017, that bug has been fixed: http://www.telerik.com/forums/remove-connections-when-removing-node

Before I post more (code) details: Is the behavior expected to work? If yes, what's a good way to debug why edges are not getting correctly deleted for me?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 02 Jun 2017, 09:37 AM
Hello Matthias,

Thank you for contacting us.

Let me first start with that when you delete a shape item from the diagram its connection will not be deleted out of the box. You need to implement custom logic to delete shape connection when a shape is deleted. An approach which you could try is to override the DiagramCommands.Delete command and in its command handler, you can delete the shape and its connections. You can take a look at the Override Diagram Command help article in our documentation which describes how you can override diagram commands

As for the forum post. The discussed behavior was related to undo command. In your case, you want to delete shape connections when a shape is deleted. This is not supported out of the box and you can achieve it using the custom code as mentioned above.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Diagram
Asked by
Matthias
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or