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

Limit connections between shapes

1 Answer 37 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 10 Feb 2015, 10:33 PM
Is there a way to limit which shapes can be connected? 

For example, my diagram has three shapes, Ellipse, Hexagon and Star. Ellipse can be connected to Star and Hexagon can be connected to Star; however, Ellipse can never be connected to a Hexagon.

1 Answer, 1 is accepted

Sort by
0
Milena
Telerik team
answered on 12 Feb 2015, 12:39 PM
Hi Mark, 

You can use RadDiagram.ConnectionManipulationCompleted event to achieve your requirements. In the arguments of that event you will be able to access all the information that you need to decide if the connection should be attached to the target or not. If you handle this event the connection will not be generated. In your case you can check the shape geometry and handle the event when the shapes are Ellipse and Hexagon. You should only have in mind that depending on the action the target or the source of the connection could be not set yet and then you can use e.Shape from the event argument which represents the new value (e.g. if you change the target the e.Shape will provide information about the target, if you change the source - for the source). 
For your convenience I implemented this approach in the attached project. Please take a look at it and let us know if it works for you.

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
Mark
Top achievements
Rank 1
Answers by
Milena
Telerik team
Share this question
or