I haven’t noticed any problems with the LinkingTool not having the end of the proposed link follow the mouse.
But if you decrease the LinkingTool.PortGravity, the mouse point has to be closer to the node’s “port” element(s). For example, you’ll notice that the DraggableLink sample sets that property to 20. This is useful because there are little port elements present on each node in addition to the big Shape.
this problem reminds me of the one I was having when I couldn’t select nodes when they were far from the origin, but seemed to go away in version 1.2.2 . Unfortunatly, this is a big problem, because now if the node is far enough out the linking tool can’t even find the node even if I force the link to go right on the node. This pretty much renders the tool unusable, so I need a way, even if I have to do the finding of the node in an override, to customize the behavior to fix it. Maybe it has something to do with being inside of Prism?
I’ve never seen or heard of a problem like that.
Do you have minimal application that demonstrates the problem?
You haven’t customized the LinkingTool, have you?
Here is my Custom Link Tool, but I was having the problem before I customized it.
protected override bool IsBeyondDragSize()
Diagram diagram = this.Diagram;
if (diagram == null) return false;
DiagramPanel panel = diagram.Panel;
if (panel == null) return false;
// Get all of the points in screen/view coordinates
Point first = panel.TransformModelToView(diagram.FirstMousePointInModel);
Point last = panel.TransformModelToView(diagram.LastMousePointInModel);
return IsBeyondDragSize(panel, last, first);
public static bool IsBeyondDragSize(DiagramPanel panel, Point a, Point b)
if (Math.Abs(b.X - a.X) <= 2)
return (Math.Abs(b.Y - a.Y) > 2);
The LinkingTool.PortGravity is a distance value, not a percentage. The default value is 100. You would not want to use a value of zero. Even a value of 2 is probably not easy to use.
This value is passed as the second argument to DiagramPanel.FindElementsNear.
ah okay. I had settled on 50.
I think I have another clue to the offset problem.
I just tried drawing new links in the DraggableLink sample of the GoSilverlightDemo (Silverlight 4) at www.goxam.com, using both Internet Explorer 8 and Firefox 3.6.
I tried both at normal page “zoom”, at 50%, and at 200% in both browsers, and at different Diagram scales. (The Diagram.Panel.Scale does not automatically change to follow the page zoom level.)
I never saw odd behavior when linking – the proper port always got highlit, and upon mouse-up the new link connected to the proper port.
That environment must be messing up the coordinate system somehow. I’m not familiar with Prism. Can you tell if it establishes some kind of transform over your content that contains a Diagram?
Also, try the GoSilverlightDemo on www.goxam.com, just to be sure it isn’t something odd about your system or browser.
The good news is it does not seem to happen for any of the demos. The bad news is its probably not environment specific. It must be either some way I configured my diagram that caused it or the fact that it is living inside of PRISM. (Prism is a silverlight framework for docking controls and windows written by Microsoft)
It seems unlikely that the problem is due to how you set any of the Diagram properties.
Perhaps we should continue this discussion off-line.