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
|
Any chance you could clarify what should happen in this scenario? We have a number of nodes with connection points that are all connected up. When we clear all of the connections on the diagram model (Diagram.Connections.Clear()), the individual connection points on the nodes are still suggesting they are connected (i.e. connectionPoint.Connections.Count > 0). Is this correct? Cheers |
|
|
Hello Thanks for asking about this. I think it would be best if clearing the connections would unhook all the connection points. This is a scenario that we overlooked. Unfortunately if I change this now I could introduce a breaking change for some developers so I best not change this until a major version. A major version may not come out until some time next year, but for now there is a simple way to work around this. Rather than using Connections.Clear, loop through the collection and RemoveAt() each connection one by one. I recommend using a while loop such as this:
If you do this in several places in your code, it would be best to encapsulate this logic in a static helper method somewhere. Jason Fauchelle |
|
|
Thanks for the reply. Ill use your solution for now. On a similar note, if i attempt to remove the connection directly from the connection point (using the RemoveConnection method) the connection is not removed from the diagram model? I assume this is related and the solution would be just to manually remove the connection from the diagram? |
|
|
Yes, using the RemoveConnection method will not delete the connection from the model. This will probably always behave this way to allow connections to be temporarily detached from a connection-point and then relocated to a new connection-point. Leaving this also allows the possibility of having connections exist in the diagram without being connected to anything like some diagram editors allow. The previous issue of clearing the connections is more like a bug. Where possible, it's easiest to delete a connection by removing it from the Connections collection as this also handles unhooking the connection points as well as deleting any connections mounted to the deleted connection. Jason Fauchelle |
|