I want to draw a horizontal/vertical RadDiagramConnection when key Shift is pressed. How to achieve this?
1 Answer, 1 is accepted
0
Milena
Telerik team
answered on 22 Aug 2014, 08:39 AM
Hi YB,
You can achieve such behavior by adding new diagram tool for creating connections on Shift pressed. To do this you should inherit ToolBase class of the RadDiagram and override the mouse/key events in the default tool.
A similar implementation you can see in our SDK example – CustomTools. There is implemented a ShapeTool for creating diagram shapes on the same user interactions. So, you can change a bit the ShapeTool:
1) You need startPoint (updated on MouseDown) and endpoint (updated on MouseMove) instead of rectangleTransformed;
2) On MouseUp you will create RadDiagramConnection instead of RadDiagramShape:
Please give this approach a try and let us know if further assistance is needed.
Regards,
Milena
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.