Issue while link creating only with points

Hi,

Please refer the following code, which I implemented:

.xaml for LinkTemplate:

<

DataTemplate x:Key=“LinkTemplate”>



<go:LinkPanel go:Part.SelectionElementName=“Path” go:Part.SelectionAdorned=“True”>



<go:LinkShape Stroke=“Black” StrokeThickness=“1” />


</go:LinkPanel>

</DataTemplate>

.cs code:

I have derived MyLinkData class as:

public class MyLinkData : GraphLinksModelLinkData<String, String>
{
}

Model:

varmodel = new GraphLinksModel<MyNodeData, String, String, MyLinkData>();

Now if I want to add a link based on only points like:

MyLinkData

link = new MyLinkData();

List

<Point> points = new List<Point>();

points.Add(

new Point(100, 50));

points.Add(

new Point(800, 50);

link.Points = points;

model.AddLink(link);

Then the expected output should be a link connecting assigned points.

But nothing displays.

Can you please let me know the reason & how can I resolve this issue?

You have set a property on your link data, but the Diagram has no knowledge of that property, because the Link DataTemplate does not reference it.

This is just like the situation where you could set the Location property of a node data, but that does not change the location of the corresponding Node unless the DataTemplate binds the go:Node.Location attached property.

However, this particular issue is more complicated than binding the Node.Location or Shape.Fill properties because one cannot data bind the Route.Points property – it is not a DependencyProperty. In order to set the Link.Route.Points property for links one has to customize the PartManager. Several of the sample applications demonstrate this. Take a look at the DraggableLink sample. You can probably use its CustomPartManager class.

Hi,

Thanks for your hint.