PortObject = GoSubGraph?

I am trying to create links between nodes and a GoSubGraph. I want my
link to connect to the edge of the GoSubGraph, in the direction the
link comes from (so all around it).

I can’t find out how to do it though. I tried adding a port with Style
= GoPortStyle.None, and PortObject set to my GoSubGraph node. But it
doesnt work as expected. Instead, there’s a small invisible port in the
upper left corner of my SubGraphNode.

Is there a way to do this?


Yes, by default if you set the GoSubGraph.Port (typically by overriding CreatePort), LayoutPort will give it the same Bounds as the Handle. You can override LayoutPort to do what you want, as taken from the CustomSubGraph example class in the SubGraphApp sample.
// CustomSubGraphPort has same Bounds as whole subgraph
public override void LayoutPort() {
GoPort p = this.Port;
if (p != null) {
p.Bounds = ComputeBounds();

FYI, in a future release we will be removing the requirement/expectation that the Bounds of the GoSubGraph are the same as the rectangle in which the border and background color are painted. For example, that will make it easier to have the Label and/or the Handle outside of the border.
At that time you’ll need to replace the call to ComputeBounds() with a call to ComputeBorder(). If there are any parts of the subgraph that stick out beyond the border, the result of ComputeBounds() would be larger than the result of ComputeBorder().
There will also be a ComputeInsideMargins method that determines the area of the subgraph’s nodes and links. ComputeBorderBounds will be implemented just to call ComputeInsideMargins and then add the margins.
Having three separate methods to talk about the three commonly used conceptual rectangles in a GoSubGraph will make it easier and cleaner to define overrides of the various GoSubGraph methods.