Position Diagram Shapes at central point

3 posts, 0 answers
  1. Andy
    Andy avatar
    2 posts
    Member since:
    Apr 2015

    Posted 22 Apr 2015 Link to this post

    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?






  2. Andy
    Andy avatar
    2 posts
    Member since:
    Apr 2015

    Posted 22 Apr 2015 in reply to Andy Link to this post

    I'm using product version 2013.2.0724.45
  3. Kiril Vandov
    Kiril Vandov avatar
    324 posts

    Posted 23 Apr 2015 Link to this post

    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

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

Back to Top