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

Create connection between Shapes

1 Answer 82 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christian
Top achievements
Rank 2
Christian asked on 03 Aug 2012, 12:46 PM
Hi there, I have a diagram where I need to connect two shapes. So I create a Connection between one shape to another, but the target is always null.
I use the ConnectionManipulationCompleted event and obtain the target from the args e.Connection.Target.

How can I obtain the target element?

1 Answer, 1 is accepted

Sort by
0
Christian
Top achievements
Rank 2
answered on 03 Aug 2012, 07:15 PM
Found my own solution here!

This is the code that I use to solve the Target Problem:
private void diagram_ConnectionManipulationCompleted(object sender, ManipulationRoutedEventArgs e)
{
 var connectedShapes = diagram.GetOutgoingConnectionsForShape(e.Shape).Select(c => c.Target);           
 var test = connectedShapes.FirstOrDefault().Content;
 
 e.Connection.Target = connectedShapes.FirstOrDefault();
}

Hope it helps.
Tags
Diagram
Asked by
Christian
Top achievements
Rank 2
Answers by
Christian
Top achievements
Rank 2
Share this question
or