Dangling Link


In my application, I am trying to create the following user flow:

  1. User drags out a node type
  2. Links are created that dangle off the node, indicating to the user what types of nodes can be linked to the newly created node
  3. User links up other existing nodes to dangling links.

To create this functionally, I catch the DiagramDrop event, and then add appropriate ports and links to the newly created node. However, the “from” portion of each of these new links is initially null until a user links up nodes (as in step 3). When the Diagram draws the links, it sets the from location to the (0, 0) by default, but I would like to place the from somewhere else on the diagram (i.e., underneath the newly created node). How would I accomplish this without creating a dummy node? I note that I can drag the link end with the mouse to desired spot, but I have not figured out how to do this programmatically. I can just set the Link.Route variable?

I apologize if this was already answered. I poked around for a bit but did not see a relevant question.


You could specify the initial link route. The DraggableLink sample does this, for example.

However the Link.Route.Points property is not data-bindable. You need to do what that and several other samples do to explicitly set the Link.Route.Points from the link data upon PartManager.DoLinkAdded and Diagram.LayoutCompleted.

Those samples also save any modified link route by overriding UpdateRouteDataPoints.