Edit itemDataArray before links drawing

Instead of: port.data..., it would be port.panel.data...

It return null each time… in my case the shape is in another shape…

$(go.Panel, 'Auto',
  $(go.Shape, 'Rectangle',
    $(go.Shape, 'Rectangle', new go.Binding('portId'));

I was assuming port was the second argument of a Binding converter function that is bound on the GraphObject whose GraphObject.portId is set or bound.

More generally, you can call the GraphObject.findTemplateBinder undocumented method to (maybe) go up the visual tree to find the Panel whose Panel.data should be referring to the bound data.