Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic connect behavior to diagram links (Read 2025 times)
rvb
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Aug 29th, 2009
connect behavior to diagram links
Aug 29th, 2009 at 7:34pm
Print Post  
I have just begun to evaluate trial version of Silverlight DiagramLite. I need to connect menus & behavior to both nodes and links. Example: a link might represent a programmatic relationship between connecting nodes. Since no right mouse, I assume way for user to edit this relationship would be via a properties dialog. Question: Is there a way to set/edit behavior for a link, as there is for a node? That is, are links just "dumb" visual connectors between nodes ... or can links contain behavior on par with nodes?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: connect behavior to diagram links
Reply #1 - Aug 30th, 2009 at 6:42am
Print Post  
Hi,

You can handle various link-related events such as LinkCreated, LinkDoubleClicked and LinkSelected to associate behavior with links. You can also add your custom data to links, either by setting their Tag property, or deriving from DiagramLink and adding some custom fields.

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


I love YaBB 1G - SP1!

Posts: 4
Joined: Aug 29th, 2009
Re: connect behavior to diagram links
Reply #2 - Aug 30th, 2009 at 5:13pm
Print Post  
Think of MVC pattern where I have previously defined classes for a "stock market" application ... Stock, Price, Ticker, Person, Symbol, Email, etc. And then I wanted to build a "process" via DiagramLite where nodes (and maybe Links) might represent a Stock, Ticker, Email, etc. I want to make these nodes and links the "View" and their corresponding classes the "Model". It sounds like I could use an event to popup a properties dialog that allowed connection between model (class instance) and view (node) ... assuming I had already written the underlying code. Is that correct? Idea being that process defined via DiagramLite could build a simple application that could be then run separately on its own.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: connect behavior to diagram links
Reply #3 - Aug 31st, 2009 at 7:44am
Print Post  
Yes, for example you could use the NodeCreated event to instantiate some model object and associate it with the node (e.g. set it as e.Node.Tag). Then LinkCreated could get the associated model objects from e.Link.Origin.Tag and e.Link.Destination.Tag and create the appropriate relation between them in the model. You could also keep a Dictionary<ModelItem, DiagramItem> as part of the view implementation so you can have faster access to the diagram elements that correspond to model objects.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint