I've subclassed DiagramLink but an exception is thrown when an unconnected link is added..I've been able to reproduce it in a sample application:
1. Add a Diagram and NodeListView with a few shapes on a silverlight page
2. Set the property :
Diagram.AllowUnconnectedLinks = false
3. Create a custom Link class:
public class LinkBase : DiagramLink
{
public LinkBase(Diagram diagram) : base(diagram) { }
}
4. Create a custom behavior class:
public class DiagramBehavior : DrawLinksBehavior
{
public DiagramBehavior(Diagram diagram) : base(diagram) { }
protected override DiagramLink CreateLink(DiagramNode origin, Point point)
{
LinkBase link = new LinkBase(Diagram);
link.Origin = origin;
return link;
}
}
5. Add:
diagram.CustomBehavior = new DiagramBehavior(diagram);
6. Now drag a node on the diagram, and draw a link pointing to nothing. Since AllowUnconnectedLinks is set to false, the link is deleted. However, a null reference is thrown in a method called by MindFusion.Silverlight.Diagram.RemoveItem().
This happens only when subclassing DiagramLink.
Are you able to reproduce this behavior? If so, is there a workaround?
Thanks!