Activate TextEditTool by code

Hello,

i want to activate a TextEditTool for a specified port within a node by code not by mouse click. My scenario is nearly identical to the DynamicPorts demo. How can I find the specified textblock of a port and activate the TextEditTool for it?

Thank you very much!

Kind regards,

Benedikt

Take a look at the State Chart sample. That sample supports the behavior that a double-click on the Link shape starts editing the TextBlock in the link label.

That behavior is implemented by the Path_MouseLeftButtonDown event handler. It goes up the visual tree by calling Part.FindAncestor, and then it goes down looking for a particular named TextBlock by calling FindNamedDescendant. Once it finds the TextBlock it initializes the TextEditingTool.TextBlock property and then starts that tool by setting Diagram.CurrentTool.

Works fine. Thank you very much!