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
|
The shapes I need have multiple input connection points and multiple output connection points. The number of connection points won't change after the shape is created. What is the most convenient way to create these shapes? |
|
|
Is this still the best solution for now? Thank you! |
|
|
Hello Xiaochu The best way to create custom nodes is to extend the DiagramNode class. Connection points can be set up in the constructor by adding connection point instances to the ConnectionPoints collection. The best sample for you to look at about this would be the ActivityDiagrams demo. This shows how to create a complete custom diagram model. This sample also implements custom connection points to include logic such as only allowing one connection to connect to each connection point. If you do not need custom logic in the connection points, you can use instances of our DiagramConnectionPoint class. This has a constructor overload that takes in a ConnectionPointDirection that you can use to specify if a connection point only accepts inputs or only produces outputs. When creating a connection point, you can specify which edge (left, right, top, bottom) of the node it will be mounted to. This also defines how connections will be routed to each connection point. The link that you posted shows how you can set the position of each connection point within the node constructor which is a technique you can use. Another way to specify the positions of connection points is within the node styles. There are examples of this in the ActivityDiagramStyle.xaml file. If you look at the ForkNodeStyle and JoinNodeStyle, you will see they use a Setter to set the ConnectionPointPositions property. The value of this can be set using a simple mini-language. "B 0.25,1; 0.75,1" for example means that for the Bottom connection points, use the relative positions 25% horizontal and 100% vertical to position the first point, and 75% horizontal and 100% vertical to position the second point. The order that these relative positions are applied can be controlled by setting the Index property of the connection points when you create them. Let me know if you need help with anything. Jason Fauchelle |
|