Get the source and target of a connection in runtime

2 posts, 0 answers
  1. Alaa
    Alaa avatar
    27 posts
    Member since:
    Jun 2014

    Posted 11 Feb 2015 Link to this post


    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. 
  2. Milena
    Admin
    Milena avatar
    201 posts

    Posted 12 Feb 2015 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top