This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have added a listener that implements IDiagramNodeRemover, to be notified when a node is being removed. However, is it possible to receive a callback 'before' the node is deleted, one that can reject the delete request? In my case we are representing a fairly complex data structure, and one rule is that the root node cannot be deleted. So I would like to prevent that if possible. A flag or something on the node itself might also be sufficient for this use case. However, it would also be useful to add a confirmation message when the user requests the deletion of a node. In my case, this also results in all of the children being deleted, so it is not a trivial operation. I haven't spotted any way of doing either of these things so far. Is it possible? |
|
|
Hello eliz The IDiagramNodeRemover happens to be exactly what you are looking for, as it is called before the removal operation is performed - in fact, it is responsible for performing the removal operation itself. In the RemoveNodes implementation of your custom IDiagramNodeRemover you will be given a list of nodes that are to be removed. Simply iterate the list of nodes, and call model.Nodes.Remove(node). If you come across a root node during this iteration, then don't remove it from the model.Nodes collection. This method can also be responsible for deleting child nodes - for each node that you remove, iterate their child nodes and remove those too. I don't know of the best MVVM way for this to display a dialog though, but it should be possible. Also, make sure to set the IDiagramModel.NodeRemover property to be an instance of your implementation so that it can take effect. Let me know if you have questions about this. -Jason Fauchelle |
|
|
Serves me right for not trying it first. Yeah, that should do the trick. |
|