Based on your query “What is the best way to display a label for a given port?", We have created simple sample to achieve your requirement. Please refer to the attached sample.
In our sample, we have override the ControlTemplate of the ConnectionPort to display ConnectionPort with Label.
Please let us know if you require further assistance on this
Thanks for the update.
Please let us know if need further assistance on this.
//Add Port to Node
private ConnectionPort addPort(Node node, Int32 p1, Int32 p2,string text)
ConnectionPort port = new ConnectionPort(node, new Point(p1, p2));
port.IsHitTestVisible = true;
port.Style = this.Resources["style"] as Style;
port.Tag = text;
port.Width = double.NaN;
port.Height = double.NaN;
port.Node = node;
node.PortVisibility = PortVisibility.AlwaysVisible;
Nice! I have as well orthogonal connectors.
I am not quite happy because if i put the :
LineConnector connector = new LineConnector();
connector.HeadNode = node;
connector.TailNode = node1;
connector.ConnectionHeadPort = port;
connector.ConnectionTailPort = port2;
connector.FirstSegmentLength = 20;
connector.LastSegmentLength = 20;
... the label is crossed out!
Reported issue : Connector is overlapped on label
We don’t have support to avoid the connector overlapping on Label. If you avoid to this, please change the position of the TextBlock in the sample side.
Following code snippet it used to change the position of the Label.
I have create an incident.
There are some more extensions about the ports.
We will update the response to your query in the respective incident – #172047. Please follow up the incident for further updates.