Guess tonode's position


while trying to connect two nodes , i want to know where the to node is the position(side).i get the quadrants with location property but i am trying to interpret which side is it(tonode) to from node.(left,right,top bottom).I require this as i want to snap the link to nearest port programitacally while connecting both the nodes based on side.

Do you really need to have multiple ports on your nodes?
That is, do you really need to have links logically and physically connect to a particular FrameworkElement, no matter where the node is?

It doesn’t sound like you do.

If you don’t, I suggest you use the default behavior of having the whole node act as the single port for the node. Don’t set go:Node.PortId on any FrameworkElements.

Then set go:Node.FromSpot=“AllSides” and .ToSpot=“AllSides” on the root element of the node. That will cause all links to be routed so that they connect to the closest side of the node, spread out on each side.

(The default behavior would be to connect at the intersection of the node’s edge with the line going to the center of the node. For orthogonal links, that would be at the middle of the closest side.)