Compass on Map for 10.2.7

770
2
09-03-2018 04:44 PM
ScottBrady2
New Contributor

Is it possible to add a compass to a map in a WPF application such that North South East and West can be displayed.

I notice version 100 supports this in the toolkit.

Is anything like this achievable with 10.2.7.

Kind Regards

Scott Brady

0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

Technically the Compass control isn't "really" a compass in the direct sense, but more of a North Arrow for the map. Ie it shows the rotation of the map with an arrow in the direction of north.

So to do this in 10.2.7 all you need to do is bind the angle on a RotateTransform applied to an arrow to the MapView's rotation.

0 Kudos
ScottBrady2
New Contributor

I have added the following code and it does not appear to work.

<Border >
<Path Data="M15,0 30,40 18,40 18,400 12,400 12,40 0,40Z" Stroke="Black" Height="100"
Fill="Black" StrokeThickness="1" HorizontalAlignment="Center"
RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<RotateTransform Angle="{Binding Angle, ElementName=MyMapView.Rotation}" />
</Path.RenderTransform>
</Path>
</Border>

When rotating the map the arrow remains stationary and does not reflect the maps rotation and point north

0 Kudos