Does RadDiagram GraphSource property support multiple parents for single node ?

5 posts, 1 answers
  1. TheFlo
    TheFlo avatar
    6 posts
    Member since:
    Sep 2012

    Posted 26 Mar 2012 Link to this post

    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
  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 27 Mar 2012 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. TheFlo
    TheFlo avatar
    6 posts
    Member since:
    Sep 2012

    Posted 27 Mar 2012 Link to this post

    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)
  5. Answer
    Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 27 Mar 2012 Link to this post

    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 >>
  6. TheFlo
    TheFlo avatar
    6 posts
    Member since:
    Sep 2012

    Posted 27 Mar 2012 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready