This project has moved. For the latest updates, please go here.

Change location and radius of a path in code

Feb 26, 2016 at 9:43 PM
Edited Feb 26, 2016 at 9:55 PM
Hi
First, your control is wonderful.
But, there is something I don't understand.

I have created in the xaml file a circle located on the map. But how can I, in the code (for example after pushing a button), change the location (Latitude, Longitude) of the circle and it's radius (RadiusX, RadiusY) ?

My XAML code :
<MapControl:Map x:Name="objMap" >
            <Path x:Name="objMapPrecision" Fill="YellowGreen" Opacity="0.5">
                <MapControl:MapPanel.Location>
                    <MapControl:Location Latitude="48.833" Longitude="2.333"/>
                </MapControl:MapPanel.Location>
                <Path.Data>
                    <EllipseGeometry RadiusX="5000" RadiusY="5000" Transform="{Binding ScaleTransform, ElementName=objMap}"/>
                </Path.Data>
            </Path>
</MapControl:Map>
Thank you in advance for your help. I start again programming, and Visual Studio has a little evolved since 10 years ;)

Julien
Coordinator
Feb 27, 2016 at 7:30 AM
Edited Feb 27, 2016 at 7:38 AM
Well, that are basic WPF questions.

In order to change the Location, you would set the attached property MapPanel.Location like this:
MapPanel.SetLocation(objMapPrecision, new Location(51.5, -0.1));
To change the circle radius you can do this:
((EllipseGeometry)objMapPrecision.Data).RadiusX = 10000;
((EllipseGeometry)objMapPrecision.Data).RadiusY = 10000;