Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom class inherited from DiagramLink (Read 2123 times)
binuvc
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 46
Joined: Nov 7th, 2011
Custom class inherited from DiagramLink
Nov 17th, 2011 at 11:21am
Print Post  
Hi,
I tried the following scenarion where i have created a custom class LinkElement inherited from DiagramLink.

public partial class LinkElement : MindFusion.Diagramming.Silverlight.DiagramLink
    {
       public LinkElement()
           : base()
       {
           InitializeComponent();
       }
    }

When I try to add this to my diagram it is throwing an object reference exception

diagramLite.Items.Add(new LinkElement());

StackTrace :

   at MindFusion.Diagramming.Silverlight.DiagramLink.x7bad83d86d80fec5()
   at MindFusion.Diagramming.Silverlight.Diagram.x329b27fa9b90943a(DiagramItem xccb63ca5f63dc470)
   at MindFusion.Diagramming.Silverlight.Diagram.x5921718e79c67372(DiagramItem xccb63ca5f63dc470)
   at MindFusion.Diagramming.Silverlight.Diagram.x847065cd3dd0f60f(Object xe0292b9ed559da7d, ItemEventArgs`1 xfbf34718e704c6bc)
   at MindFusion.Diagramming.Silverlight.CollectionBase`2.RaiseAdding(T item)
   at MindFusion.Diagramming.Silverlight.CollectionBase`2.xd6b6ed77479ef68c(T xccb63ca5f63dc470, Boolean x808547253555a9ba)
   at MindFusion.Diagramming.Silverlight.CollectionBase`2.Add(T item)

Please advice.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom class inherited from DiagramLink
Reply #1 - Nov 17th, 2011 at 11:34am
Print Post  
Hi,

It seems you must set the link's Origin and Destination before adding it. If you don't know the origin and destination yet, use the DummyNode class:

Code
Select All
var link = new LinkElement();
link.Origin = new DummyNode(diagram);
link.Destination = new DummyNode(diagram);
diagram.Items.Add(link); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
binuvc
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 46
Joined: Nov 7th, 2011
Re: Custom class inherited from DiagramLink
Reply #2 - Nov 17th, 2011 at 12:05pm
Print Post  

Its working now!!

Thanks Smiley

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint