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

calculating shape parameters

1 Answer 64 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Rajkumar
Top achievements
Rank 1
Rajkumar asked on 14 Jul 2014, 10:39 AM
Hi,

Suppose I have a custom shape based out of EllipseGeometry.

If I resize the diagram item in the diagram, only the Width and Height are updated. 

If I need the actual RadiusX and RadiusY of the EllipseGeometry, what needs to be done ?

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 15 Jul 2014, 03:25 PM
Hello Rajkumar,

The RadDiagramShapes doesn't listen for changes in the properties of their Geometries. This is why the RadiusX and RadiusY properties of your EllipseGeometry are not updated when you resize the shape.

In order to update those properties you can subscribe for the SizeChanged event of the shape and modify them based on the shape's width and height in the event handler.
private void RadDiagramShape_SizeChanged(object sender, SizeChangedEventArgs e)
{
    RadDiagramShape shape = sender as RadDiagramShape;
    if (shape != null)
    {
        var geometry = shape.Geometry as EllipseGeometry;
        if (geometry != null)
        {
            geometry.RadiusX = shape.ActualWidth / 2;
            geometry.RadiusY = shape.ActualHeight / 2;
        }               
    }
}

Please let me know if this works for you.

Regards,
Martin
Telerik
 
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.
 
Tags
Diagram
Asked by
Rajkumar
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or