Center on a specific shape

3 posts, 0 answers
  1. Clément
    Clément avatar
    5 posts
    Member since:
    Jan 2014

    Posted 23 Jan 2014 Link to this post


    I've got a project where I need to "center" the diagram on a specific shape.

    I've found the BringIntoView methods but it's not fit completly. I did also try to compute the new position to programmatically set the new diagram position but it seems to go awkwardly...
  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1236 posts

    Posted 27 Jan 2014 Link to this post

    Hello Clément,

    Could you please confirm that you have tried the BringIntoView() method of the RadDiagram control. I tested it on our side and it seems to works as expected. I subscribed to the SelectionChanged event of the RadDiagram and implemented the handler like so:

    private void RadDiagram_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
        if (e.AddedItems.Count != 0)
            diagram.BringIntoView((e.AddedItems[0] as RadDiagramShape), 1, true);
    Please give this approach a try and let me know if it works in your specific scenario.

    Pavel R. Pavlov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. Clément
    Clément avatar
    5 posts
    Member since:
    Jan 2014

    Posted 27 Jan 2014 in reply to Pavel R. Pavlov Link to this post

    Thanks you for the answer!

    I've try this sample in a dummy project also and at the time it didn't worked. It kept sending me the specified Item into the left upper corner.

    Then, I just give it a try it in the real project (left upper was better than nothing…), it finally worked as expected. I didn't understand the difference between the two solutions but... it finally works so!! Thanks again!

Back to Top