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
|
Is there an event I can hook to get notified that a node or connection was deleted? We are using your product to build a process layout engine that creates and destroys pretty complex data structures on the back end. I know I can control what happens when a node or connection is created (via the builder interfaces), but I can't seem to figure out how I can get delete notifications from the model. All the collection properties return ILists, so there are no collection change events to hook (at least without possibly relying on an implementation detail). |
|
|
Hello Matt There are a couple of ways you can do this. The first way is indeed an implementation detail. The FlowDiagramModel class has a Nodes and Collections property as you probably already know. These collections can be cast into an ObsevableCollection of FlowDiagramNode or FlowDiagramConnection. This will allow you to hook into the change events. Similarly with the node and connection builders, there is also a remover interface. On the FlowDiagramModel class, you will see a NodeRemover and ConnectionRemover property. you can implement an IDiagramNodeRemover and IDiagramConnectionRemover to give you more control with what happens when the user wants to delete something. They each have a single method to implement which takes the diagram model, and a list of nodes or connections being deleted. To implement them, you'll simply need a 'for' loop that goes through the list and deletes the items from the given diagram. Then you can include what ever additional logic you need in the event of a node or connection being deleted. Choose which ever technique will be easiest for your situation. Since you need to know when a node or connection is being deleted, I should point your attention to the ConnectionRelocator. If your diagram allows users to relocate the end of a connection to another node, then you may want to listen for this as well. Let me know if you need more information about it. Hope this all helps |
|
|
This is perfect Jason, thank you very much. We are still in the evaluation/demo phase with your software, but I had to say: So far your API, level of customization and your support responses (that I've read in this forum) have reflected glowingly on your company and the developers that work there, so keep up the good work :) |
|
|
Jason, I cannot find the IDiagramNodeRemover interface, and I don't see where the IDiagramModel (Nor the FlowDiagramModel implementation) have any properties about removers. Were those interfaces and properties made internal? |
|
|
Hello No these are not internal. Sounds like you may have an older copy of WPF Flow Diagrams. If so, download the trial again. If you downloaded the trial recently, then there should be a NodeRemover and ConnectionRemover property on FlowDiagramModel. Let me know if you still can't see it. Cheers |
|
|
Specifically, make sure to download the nightly build (trial edition from the Downloads page, retail edition from the store). |
|
|
Ah hah, that was it. Thanks again guys. I didn't have the latest version, which is why I never noticed the Remover interfaces in the first place :) |
|