Route points cleared when second link is drawn

Apparently this is my week to have all of the strange issues. Cry

I have two nodes (oriented at NW and SE compass positions) that have Node.LinkableDuplicates set to true. I draw a bezier link between them. I then reshape the link by pulling one reshape handle to the right. Finally I draw a second link in the same direction and the points of the first link move back to their original location. Subsequent links all seem fine: it’s just the first link that is losing it’s points.

My link template is fairly simple:


<DataTemplate x:Key="LinkTemplate"
  DataType="{x:Type go:Link}">
  <go:LinkPanel go:Part.Reshapable="True"
    go:Part.SelectionElementName="Path"
    go:Part.SelectionAdorned="True">
    <go:Link.Route>
      <go:Route Curve="Bezier" />
    </go:Link.Route>
    <go:LinkShape x:Name="Path"
      go:LinkPanel.IsLinkShape="True"
      Stroke="Black"
      StrokeThickness="2" />
    <Path Stroke="Black"
      StrokeThickness="1"
      Fill="Black"
      go:LinkPanel.FromArrow="BackwardTriangle" />
    <Path Stroke="Black"
      StrokeThickness="1"
      Fill="Black"
      go:LinkPanel.ToArrow="Triangle" />
    <Border Background="{StaticResource DiagramBackground}">
      <TextBlock Text="{Binding Data.Text}"
        Margin="3" />
    </Border>
  </go:LinkPanel>
</DataTemplate>

For the life of me I can’t figure this out. I pulled out my SelectionTemplate and the custom PartManager that pushes the Link.Route.Points into the GraphLinkModel class in order to get things as simple as possible, but I still saw this odd behavior.

That’s because the link routing changes when there are multiple links between the same pair of ports. In the case of going from 1 to 2 links, it explicitly invalidates the route of the original link so that it can change to accomodate the additional link. The same kind of thing happens when going from 2 links down to a single link.

The LinkReshapingTool doesn’t set any flag saying that the link had been re-routed, so there’s no way for the link routing code to know that it should leave it alone. The best you can do in this situation is to set the Route.Adjusting property. For this case I would recommend setting Adjusting=“Stretch”.