How to display a North Arrow on a MapView - C# Xamarin Forms

1900
2
Jump to solution
11-05-2020 07:25 PM
SquarecodeDeveloper
New Contributor II

I have a C# Xamarin Forms UWP Application displaying a map in the MapView. The client want to add a North Arrow to the map.

After hours of googling I have no idea of how to do this.

My code is very similar to this official Arcgis example

arcgis-runtime-samples-dotnet/src/Forms/Shared/Samples/MapView/DisplayLayerViewState at master · Esr... 

How would I add a North Arrow to a map like that.

Bonus topic - if the map is rotated (as per one of the other example in that project) I would like the arrow to keep pointing in the right direction.

We are on version 100.6 of Esri.ArcGISRuntime and Esri.ArcGISRuntime.Xamarin.Forms

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

The toolkit provides a control that does this for you. 

First add a reference to the toolkit nuget Esri.ArcGISRuntime.Toolkit.Xamarin.Forms

And see example here how to use it:

arcgis-toolkit-dotnet/CompassMapViewSample.xaml at main · Esri/arcgis-toolkit-dotnet · GitHub 

compass


Alternatively you can use just an image of an arrow, and listen for the MapView's MapRotation property to change using the PropertyChanged event, and then rotate the image accordingly.

View solution in original post

2 Replies
dotMorten_esri
Esri Notable Contributor

The toolkit provides a control that does this for you. 

First add a reference to the toolkit nuget Esri.ArcGISRuntime.Toolkit.Xamarin.Forms

And see example here how to use it:

arcgis-toolkit-dotnet/CompassMapViewSample.xaml at main · Esri/arcgis-toolkit-dotnet · GitHub 

compass


Alternatively you can use just an image of an arrow, and listen for the MapView's MapRotation property to change using the PropertyChanged event, and then rotate the image accordingly.

SquarecodeDeveloper
New Contributor II

Thanks worked great

0 Kudos