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

Connecting a connection to another connection

1 Answer 57 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Veteran
Tom asked on 11 Nov 2020, 06:30 PM

Hello Telerik staff,

First of all, allow me to thank you for all the help your team has provided me. After implementing custom shapes in my RadDiagram, I discovered that I require to create a connection that allows me to link other connections to it (please, see attached image). I have perused the forum and the documentation, but I have not found any clue that could lead me to a solution.

Thank you very much.

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 12 Nov 2020, 10:44 AM

Hello, Tom,

Thank you for the feedback! I am really glad to hear that we help you achieve your goals.

By default, when you create a connection you should specify the Source and Target properties which expects an ElementShape to be passed. You can achieve your requirement by adding an additional shape and set its Visibility to Collapsed. Please refer to the following code snippet. I have attached my test project as well.

public RadForm1()
{
    InitializeComponent();
    RadDiagramConnection polylineConnection = new RadDiagramConnection() { Name = "connection1" };
    polylineConnection.Source = this.radDiagram1.Shapes[0];
    polylineConnection.Target = this.radDiagram1.Shapes[1];
    polylineConnection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline;
    radDiagram1.AddShape(polylineConnection);

    RadDiagramConnection polylineConnection2 = new RadDiagramConnection() { Name = "connection1" };
    polylineConnection2.Source = this.radDiagram1.Shapes[2];
    polylineConnection2.Target = this.radDiagram1.Shapes[3];
    this.radDiagram1.Shapes[3].Visibility = ElementVisibility.Collapsed;
    polylineConnection2.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline;
    radDiagram1.AddShape(polylineConnection2);
}

I hope this helps. Let me know if you have other questios.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Diagram, DiagramRibbonBar, DiagramToolBox
Asked by
Tom
Top achievements
Rank 1
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or