1.2: Route.ToEndSegmentDirection

Sometimes you want to rotate a node that has ports, either programmatically by setting Node.RotationAngle or interactively using the RotatingTool, and you want to have orthogonal links connect to the ports in a correspondingly rotated direction, rather than in the original direction.

For example, the Logic Circuit sample has unrotatable nodes. Let’s extend that sample to allow users to rotate the nodes in multiples of 90 degrees.

First, we add go:Part.Rotatable="True"to the root element of each node template that we want users to be able to rotate interactively. In the Logic Circuit sample that means on the go:SpotPanel of the “OneInOneOut” and “TwoInOneOut” DataTemplates.

Second, we add

<span style="font-weight: bold;"></span>FromEndSegmentDirection="RotatedNodeOrthogonal" ToEndSegmentDirection="RotatedNodeOrthogonal"to the go:Route that is attached to the go:LinkPanel of the “Wire” DataTemplate.

Third, we customize the RotatingTool of the Diagram:

<go:Diagram.RotatingTool> <go:RotatingTool SnapAngleMultiple="90" SnapAngleEpsilon="45" /> </go:Diagram.RotatingTool>
Here’s one result of rotating the nodes in the Logic Circuit sample:

This is also demonstrated in the Piping and DraggableLink samples.