When I press a button to add a shape to my canvas I need it to be placed inside my current viewing area on the canvas. Currently, I have it hard-coded. Do you have some example code to do this? I pass the position using my "GroupDD" object.
Sorry for the incorrect title. Originally, I thought I wanted it on the Mouse Position. But, because I'm pressing a button my mouse won't be over the canvas.
answered on 12 Aug 2014, 12:57 PM
I don't think I understand what you mean by saying "Currently, I have it hard-coded". Can you please explain what is hard-coded and where? This will allow me to understand your scenario better.
As for the current viewing area, you can get it with the Viewport property of the RadDiagram. The property contains the current visible area of the diagram. For example if you want to set the shape on the middle of the view port you can use the following code:
You can use the Viewport to calculate where you want to place your shape.
Please let me know if this works for you.
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.