Moving a Node across the link

Hi,

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?

Thanks
Kirthi

I’m sorry, but I’ve read your post several times now and I still cannot understand what you want to do.

Can you describe precisely what Nodes and what Links there are and how they are related to each other?

Are you asking about restricting the user’s dragging of the label Node so that it can only be moved along the path of the labeled Link?

Or are you asking about some new feature for some DiagramLayout? If so, which one, and how?

Or are you asking something else?

Consider the following diagram

Here there are 2 nodes and a link which connects both the nodes. The link also has a label which is a data template consisting of a port.

What I want to do is to drag another node on the link label just like below

The dragged node can be slightly below/above the link.

Also I want to drag/move “Node 3” across link like below:

But moving like this shouldn’t be allowed:

i.e It should always be nearer to the link on which it was dragged.

I have tried using groups but haven’t been able to achieve this requirement.

Please let me know if there is any possibility to achieve it.

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.

Yes, to restrict the user’s dragging of a node, you’ll need to implement on override of DraggingTool.ComputeMove.