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

Get the source and target of a connection in runtime

1 Answer 143 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Alaa
Top achievements
Rank 1
Alaa asked on 11 Feb 2015, 02:52 PM

How can I get the source and target of a connection in runtime?
I tried this event from RadDiagram ConnectionManipulationCompleted, but it gives me the target is null, while I'm sure I linked it to the second shape.
If there is a way to get all connections for for each RaddiagramShape it would be much better than hitting an event inside the RadDiagram.
Please, reply me as fast as possible.

Thank you. 

1 Answer, 1 is accepted

Sort by
0
Milena
Telerik team
answered on 12 Feb 2015, 09:45 AM
Hi Alaa,

I will try to answer all of your questions in the order they appeared. 

I tried this event from RadDiagram ConnectionManipulationCompleted, but it gives me the target is null
When you change the target of a connection and use ConnectionManipulationCompleted event, the target property of the connection is not yet set (null) because you can mark the event as handled and the connection will be discarded. But you can use e.Shape or e.Connector from the arguments of the same event. They provide information about the new target of the connection and the Connector of the Shape to which the RadDiagramConnection is connected.  The same is valid for the source of the connection.

If there is a way to get all connections for for each RaddiagramShape
You can use two extension methods GetOutgoingConnectionsForShape and GetIncomingConnectionsForShape of the RadDiagram to iterate through the incoming and outgoing connections of a shape. More information about them you can find in our help topic Iterate Over the Diagram Items(Extension Methods section).

I hope this information is helpful.

Regards,
Milena
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Diagram
Asked by
Alaa
Top achievements
Rank 1
Answers by
Milena
Telerik team
Share this question
or