That should just work. The reason links appear to stay connected with their ports, for example when a person drags a node, is because movement of a port will notify all connected links, which will cause GoLink.CalculateRoute to be called. This calls CalculateStroke to actually figure out what new stroke path (i.e. points) the link should have.
Could you check the Bounds of the links before and after moving the port?
GoObject.OnBoundsChanged is called when the Bounds of the object changes. So GoPort.OnBoundsChanged is overridden to call GoPort.LinksOnPortChanged.
Thanks for the input. I found that I am adding new links as a child of Node containing junction port. But when I added links to view’s document instead of Node, it solved this painting problem. Is it compulsory to add links as Child to GoDocument? I remember having read in user guide that links are always added to document’s linkslayer.
- No – in fact it’s standard for links that are “part” of a GoSubGraphBase to be a child of that node. However, your nodes aren’t “subgraphs”, so it’s standard to have the links be owned as top-level objects in some layer of the document.