This is a migrated thread and some comments may be shown as answers.

Does RadDiagram GraphSource property support multiple parents for single node ?

4 Answers 183 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
TheFlo
Top achievements
Rank 1
TheFlo asked on 26 Mar 2012, 03:31 PM
Hi all !

I'm having a closer look to the new RadDiagram component (and Q2 Roadmap) and I was wondering if the GraphSource property was (or will be) supporting nodes with multiple parents or should this achieved manually ?
I've attached a sample diagram to give a better view of what I would like to achieve.
Many thanks for your help !
TheFlo

4 Answers, 1 is accepted

Sort by
0
Miro Miroslavov
Telerik team
answered on 27 Mar 2012, 07:28 AM
Hi Florian,

 I easily managed to achieve what you need using just the currently available GraphSource. You can see the attached image of the RadDiagram. 

var graph1 = new DiagramViewModel() { Name = "Diagram 1" };
graph1.InternalItems.Add(new NodeViewModelBase() { Content = "Parent 1", Position = new System.Windows.Point(0, 0) });
graph1.InternalItems.Add(new NodeViewModelBase() { Content = "Parent 2", Position = new System.Windows.Point(100, 0) });
graph1.InternalItems.Add(new NodeViewModelBase() { Content = "Parent 3", Position = new System.Windows.Point(200, 0) });
graph1.InternalItems.Add(new NodeViewModelBase() { Content = "Child 1", Position = new System.Windows.Point(100, 100) });
graph1.InternalItems.Add(new NodeViewModelBase() { Content = "Child 2", Position = new System.Windows.Point(0, 200) });
graph1.InternalItems.Add(new NodeViewModelBase() { Content = "Child 3", Position = new System.Windows.Point(200, 200) });
 
graph1.InternalLinks.Add(new LinkViewModelBase<NodeViewModelBase>(graph1.InternalItems[0], graph1.InternalItems[3]));
graph1.InternalLinks.Add(new LinkViewModelBase<NodeViewModelBase>(graph1.InternalItems[1], graph1.InternalItems[3]));
graph1.InternalLinks.Add(new LinkViewModelBase<NodeViewModelBase>(graph1.InternalItems[2], graph1.InternalItems[3]));
graph1.InternalLinks.Add(new LinkViewModelBase<NodeViewModelBase>(graph1.InternalItems[0], graph1.InternalItems[4]));
graph1.InternalLinks.Add(new LinkViewModelBase<NodeViewModelBase>(graph1.InternalItems[3], graph1.InternalItems[4]));
graph1.InternalLinks.Add(new LinkViewModelBase<NodeViewModelBase>(graph1.InternalItems[3], graph1.InternalItems[5]));

I'm using a few base ViewModels that are present in the Features project part of the Demos (Quick Start Framework) solution under your Telerik installation  folder.
Please  let us know if you have further questions regarding multi graphs and the RadDiagram in general. 

Kind regards,
Miro Miroslavov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
TheFlo
Top achievements
Rank 1
answered on 27 Mar 2012, 10:26 AM
Hi Miro,
This looks great, thank you very much !

I've searched in the Features project for the "DiagramViewModel" you're referring in your code sample and I was unable to find any references to it...
Although I've been able partially reproduce your example using your sample code and a custom class object implementing GraphSourceBase<NodeViewModelBase, LinkViewModelBase<NodeViewModelBase>> like done in the Features project, I would really be grateful if you could give me further details on how you achieved the multigraph of your attached image.
Please find attached a new image of what I've achieved so far.
Do I need to modify the ViewModels of the Features project in order to override the ToString method ?
Do I need to implement templates for the nodes and links ?
Many thanks for your help !
TheFlo

(I'm using the ViewModels of the Features project packaged with RadControls for WPF Q1 2012)
0
Accepted
Miro Miroslavov
Telerik team
answered on 27 Mar 2012, 11:58 AM
Hi Florian,

 DiagramViewModel is part of my sample. You can find the attached example of how I'm doing it. You can also have a loot at our DataBinding help article regarding the RadDiagram (and the articles too). Also you can take a look at this blog post regarding the future of the Diagram.
About the templates, in your sample you setting Content to your connections and that's why you see the string version of that Content. If you want to have text in your connections that you should better use the ConnectionTemplate property to define how it should look like. 
Please let me know if you need further help.

Kind regards,
Miro Miroslavov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
TheFlo
Top achievements
Rank 1
answered on 27 Mar 2012, 01:18 PM
Hi Miro,
Thanks you for your quick answer and the sample !
I now understand how this is working and managed to achieve my graph properly.
Kind regards,
TheFlo
Tags
Diagram
Asked by
TheFlo
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
TheFlo
Top achievements
Rank 1
Share this question
or