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
|
Hi, we have a request over here on how the diagram can handle multiple connections at once. Please refer to the picture for the scenario: Basically, we have custom connection points that being implemented by adding the 'index', which is the number that you saw in the picture on each connection point. Whenever user selects multiple nodes, and start dragging the connections from one connection point, is it possible for us to create the visual lines like what I'd draw in the picture? Multiple visual lines shows that connections will be created as long as they have the same 'index'. |
|
|
Hello I have attached a sample demonstrating how to implement this logic. No need to get the latest nightly builds to run this, just include a reference to the Mindscape.WpfDiagramming.Foundation.dll - version 2.0. To use the sample, select multiple nodes using Ctrl+mouse click. then drag from one of the connection point thumbs. You will see that a connection line will be created from the same edge of all selected nodes. All the logic for this can be found in the MainWindow.xaml.cs file in the sample. I have implemented this logic by attaching routed event handlers to the DiagramSurface to listen for drag-started, drag-delta and drag-completed events. In the drag-started event handler, I iterate through all the connection point thumbs on the selected nodes and add them to a set of "captured thumbs" if they meet the appropriate criteria. I also force them to start dragging. Then in the drag-delta and drag-completed handlers, I iterate through the captured thumbs and force them to mimic the thumb that the user is dragging. You can modify the condition on line 69 for capturing the appropriate thumbs. Here you can make a check that your Index property on the thumb is the same as the Index property on the thumb that the user is dragging. You may also want to remove the Edge condition there. |
|
|
Hi Jason, Thanks for your sample, it looks exactly like what I wanted to implement. I am trying to implement it in my project and see whether it works in my scenario. BTW, is that means that we have to use Diagram2.0 for our diagram right? Seems like we need to get our migration done first before we can fully implement the feature. Thanks. |
|
|
Hello The way I have implemented it does not take advantage of any of the Diagrams 2.0 content. It should work in version 1.0, but I havn't tested this. Though it is recommended that you still migrate to version 2.0. Let us know if you have any questions about this. - Jason |
|