Connect two items programmatically

3 posts, 0 answers
  1. Sina
    Sina avatar
    13 posts
    Member since:
    Jan 2011

    Posted 21 Jun 2017 Link to this post


    I want to connect two item on the diagram programmatically. I am not sure that the procedure is correct or not?

    1) set a uniqe ID (name)

    2) search diagram.Shap array and find two ID

    3) make connection with source and target index based on ID <name> found in step 2

    Thank you.

  2. Hristo
    Hristo avatar
    1522 posts

    Posted 23 Jun 2017 Link to this post

    Hello Sina,

    Thank you for writing.

    You can find shapes in your diagram based on their name, then you can create a connection between them using the approach suggested here:

    var source = this.radDiagram1.Shapes.Where(s => s.Name == "Source").FirstOrDefault();
    var target = this.radDiagram1.Shapes.Where(s => s.Name == "Target").FirstOrDefault();
    RadDiagramConnection polylineConnection = new RadDiagramConnection() { Name = "connection1" };
    polylineConnection.Source = source;
    polylineConnection.Target = target;
    polylineConnection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline;

    I hope this helps. Should you have further questions do not hesitate to write back.

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Sina
    Sina avatar
    13 posts
    Member since:
    Jan 2011

    Posted 24 Jun 2017 in reply to Hristo Link to this post

    Dear Hristo,

    It works! 

    Thank you. 

Back to Top