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

Center on a specific shape

2 Answers 63 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Clément
Top achievements
Rank 1
Clément asked on 23 Jan 2014, 07:47 AM
Hello,

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 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 27 Jan 2014, 11:45 AM
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.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
0
Clément
Top achievements
Rank 1
answered on 27 Jan 2014, 12:58 PM
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!




Tags
Diagram
Asked by
Clément
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Clément
Top achievements
Rank 1
Share this question
or