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

Position Diagram Shapes at central point

2 Answers 131 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 22 Apr 2015, 10:36 AM

Hi all,

This is my first post and would like to say how much I'm enjoying using the RadDiagram.  Great work, keep it up.

My understanding is diagram shapes are positioned at the top left.  I have a requirement to position shapes centrally and want the x, y coordinate represents the center of the shape rather than the top left.

Is there a diagram setting to change this behaviour?

 

Thanks

 

 

 

2 Answers, 1 is accepted

Sort by
0
Andy
Top achievements
Rank 1
answered on 22 Apr 2015, 10:53 AM
I'm using product version 2013.2.0724.45
0
Kiril Vandov
Telerik team
answered on 23 Apr 2015, 12:14 PM
Hello Andy,

There are is no build in setting which you could set to make change that behavior. However you could easily make the Shape to be positioned based on the requirement. You could use one of the following approaches:
- If you are in MVVM scenario and you want to Position the shapes based on the center of the shape you could bind the Position/Width/Height properties of the shape. Then calculate the position based on the Width and Height of the shape and make the modification you need. But in the end the Position still will be the TopLeft of the shape.
- another approach is to inherit the RadDiagramShape and extend it. You could do that by creating a new property CenterPosition which internally uses the position and the Width/Height of the shape.

I have attached a sample project demonstrating the second approach. I hope this information helps. Please let us know if you need further assistance.

Kind regards,
Kiril Vandov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Diagram
Asked by
Andy
Top achievements
Rank 1
Answers by
Andy
Top achievements
Rank 1
Kiril Vandov
Telerik team
Share this question
or