I have couple of nodes and a link that connects both the nodes and the link has linklabelled node. I wanna create a node to linklabelled node which is fine. Now the node linked to labelled node should have an option called as automatic layout and when I click on automatic layout the highlighted node should only be able to move across the line of the link no where else.
Can this be acheived?
The basic answer is to override DraggingTool.ComputeMove – if the Node is acting like your “Node 3”, then be sure to return a new location point that is “near” the Link.
Are you saying that you want “Node 3” to be dropped “into” the link label Node? If so, you might want to implement the link label Node as a Group, and then drop “Node 3” into that Group. That’s an easy way to tell the Node which Link it belongs to. Also, when the Link is copied or deleted, the label Group and the Group’s member Nodes will be copied or deleted. This is demonstrated by the Piping sample in GoWpfDemo. The pipes are Links, each of which has a link label Group. When the user drags an instrument (a Node with Category == “Instrument”) it highlights the link and when dropped it adds the Node to the label Group.
But I’m not confident that the behavior implemented in the Piping sample is what you want.
I have implemented the grouping but in the grouping of nodes I can place the nodes at any distance from the link. Rather, I would require something similar to Fish Bone example in the demo application.