Relink only one side of the link

Hello all

An easy problem I hope:

I need a link connected with two objects. Only one part of the link may be relinked to a third object. The user should not be able to relink the other side of the link (meaning if the user tries to drag the port nothing hapens).

I’ve checked GoView.Relinkable and it seems to apply to both ports of the link. Also the port has no way of specifying whether the link may be relinked.

It seems that GoToolRelinking.RelinkableFromHandle or GoToolRelinking.RelinkableToHandle are the solutions.

But they are rather undocumented.

Can anybody give me some clues?



You could override GoLink.AddSelectionHandle to call the base method and then modify the handle whose HandleID was GoLink.RelinkableFromHandle (or the other one, depending on which end you want to disable relinking).
The following code is untested:

public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj) {
  base.AddSelectionHandles(sel, selectedObj);
  GoHandle h = sel.FindHandleByID(this, GoLink.RelinkableFromHandle) as GoHandle;
  if (h != null) {
    h.HandleID = NoHandle;
    h.Style = GoHandleStyle.Rectangle;
    RectangleF r = h.Bounds;
    r.Inflate(-1, -1);
    h.Bounds = r;

My version of GoDiagram (v2.2.1) does not contain FindHandleByID().

So here is what i’ve done:

public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj)


this.RemoveSelectionHandles(se l);

PointF handlePoint = this.GetPoint(this.LastPickIndex);

IGoHandle handle = sel.CreateResizeHandle(this, selectedObj, handlePoint, GoLink.RelinkableToHandle, true);

GoHandle goh = handle.GoObject as GoHandle;

if (goh != null)


goh.Style = GoHandleStyle.Diamond;

goh.Brush = new SolidBrush(((DocumentTabView)this.Document).GraphicalView.Pr imarySelectionColor);

RectangleF bounds = goh.Bounds;

bounds.Inflate(1, 1);

goh.Bounds = bounds;




base.AddSelectionHandles (sel, selectedObj);