Hi there,
I don’t know how to reproduce that problem. (Apparently Silverlight, but which version?)
For example, if I run the Dynamic Ports sample and select some nodes along with the links between them, I can reshape some of the links. Then I can drag the selection off-screen. If I scroll to where I dropped the selected nodes and links, the links still have the routing/shape that I gave them.
Note: if the links have Routing=“AvoidsNodes”, the links are supposed to re-route. But according to your LinkTemplate XAML, that’s not the case for you.
I should have mentioned - using silverlight 4.
It happens as soon as the node that the link is connected to leaves the screen. Here is the xaml for a node template.
<Image Width=“138” Name=“imgCloud” Source="/NetDoc5.Web.UI;component/images/cloud.PNG" />
<Grid Width=“138”>
<Grid.RowDefinitions>
<RowDefinition Height=“40” />
<RowDefinition Height="" />
<RowDefinition Height=“40” />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=“20” />
<ColumnDefinition Width="" />
<ColumnDefinition Width=“20” />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column=“1” Grid.Row=“1” FontWeight=“Black” FontSize=“9” HorizontalAlignment=“Center” VerticalAlignment=“Center” Text="{Binding Path=Data.CloudDataBlockData.Name, Mode=TwoWay}" />
<Grid Grid.Column=“1” Grid.Row=“2” Margin=“0,0,9,0”>
<Rectangle Width=“8” Height=“8” Margin=“0,1.5,0,1.5”
go:Node.PortId="{Binding Data.CloudDataBlockData.NetworkID, Mode=TwoWay}" Tag=“Bottom” go:Node.FromSpot=“Center”
go:Node.LinkableTo=“True” go:Node.ToSpot=“Center”
Stroke=“Black”>
<Rectangle.Fill>
<SolidColorBrush Color="#FF00BB00" />
</Rectangle.Fill>
</Rectangle>
<TextBlock FontSize=“6” HorizontalAlignment=“Center” Padding=“0,0,0,0” TextAlignment=“Center”
VerticalAlignment=“Top” Text=“X” Foreground=“Gray” />
</Grid>
</Grid>
</Grid>
</DataTemplate>
First, an unrelated issue: I’m surprised you’re not getting run-time warnings about the data-binding of go:Node.Location on the inner Grid.
go:Node.Location, like most of the Part attached properties, should only go on the root element of the DataTemplate, not on a nested element. (Attached Node properties relating to “ports” are exceptions.)
Second, I modified the Dynamic Ports sample to remove the Diagram.DragSelectingTool: DragSelectingTool="{x:Null}". This allows the user to pan the diagram while still allowing the user to select nodes or links, to move them, and to reshape the links.
I’m still not seeing any problem.
And I’ve tried this in the State Chart sample too, where the link routes are loaded from saved XML. And I tried that two ways: with Route.Adjusting=“Stretch” and with Adjusting=“None”.
I have found the cause of the problem, I’m guessing its a possible bug. it only happens when I use a linkpanel, so for example, this link template works just fine:
</DataTemplate>
Hmm, that’s still odd, because the State Chart link template uses a LinkPanel.
Yes it is strange, I have three different link templates that I removed from being nested inside linkpanel and all three links are now maintaining their routing now.
Doubly strange: I just copy/pasted your link DataTemplate using a LinkPanel, and could not reproduce any problems. I modified State Chart, and loaded the diagram from XML with modified link routes.
Maybe I am using this wrong - I went into the samples, and modified the template of LinkTemplate in DynamicPorts.xaml to just be contained in the linkpanel like so :
Well, as I mentioned about most Part attached properties – you need to make sure that they are on the root element of the DataTemplate.
When you wrap the old template contents with a panel, you also need to move those attached properties up to the panel.
<DataTemplate x:Key=“LinkTemplate”>
<go:LinkPanel go:Part.SelectionElementName=“Path”
go:Part.SelectionAdorned=“True” go:Part.Reshapable=“True”>
<Path go:LinkPanel.IsLinkShape=“True” Stroke=“Black” x:Name=“Path” StrokeThickness=“1”>
<go:Link.Route>
<go:Route Routing=“Orthogonal” Corner=“4” RelinkableFrom=“True” RelinkableTo=“True”/>
</go:Link.Route>
</Path>
</go:LinkPanel>
</DataTemplate>
But I wouldn’t have thought that that error would cause the behavior you are seeing.I just copied the adjustments you gave me to the example, and while the links are now selectable, the routing still doesnt behave like it did initially. Its more or less from A to B in a straight line now, instead of before routes had several points where you could select a link, move it around and adjust it. Now I can select a ‘link’, but I can’t really adjust it or move it around unless I move the node.
Ok… after more messing around once I removed
… sorry about all the posts…problem resolved…