Tooltip with portId on port of a node

Hi, how could I bind the text of the tooltip on the port to the portId value? I have some nodeTemplate with tooltip on the port

var OMNI2WTemplate =
     $(go.Node, "Spot", $(go.Shape, "Rectangle", shapeStyle()), nodeStyle(),
     $(go.Shape, "Rectangle", portStyle(false),
     { portId: "FE4", alignment: new go.Spot(0.9, 1),toolTip:sharedToolTipPort }));

And tried to get the value on sharedToolTipPort class as follows:

var sharedToolTipPort =
        $(go.Adornment, "Auto",
        $(go.Shape, "RoundedRectangle", { fill: "lightyellow" }),
        $(go.TextBlock, { margin: 2 },
            new go.Binding("text",  "" , function(d) { return d.portId)));

But it seems that “d” is the node, not the port, so I’ve got the empty string in the tooltip. Am I doing something wrong or it is expected behaviour?

well, the easy thing to do would be to make a two-way data binding on the portId so that you can look at data.portId (assuming your binding was 'portId', 'portId')

If not, you could write:

new go.Binding("text",  "" , function(d, obj) {
          return obj.part.adornedObject.portId;
        }

since adornedObject is the shape in question.

Thank you! This works fine.