Search code examples
c#xamarin.formsarcgis-runtime-net

Display compass - ArcGIS Runtime SDK - Xamarin.Forms


I am using the 1st release of the ArcGIS Runtime SDK for .Net - Xamarin.Forms (nuget package here).

One of the requirements is to display a compass that indicates the north. I haven't found any build-in feature for the moment. Is someone can point me out how to implement this functionality ?


Solution

  • So after few research, I've implemented a custom solution:

    • Find a compass icon that can rotate (see this article to add image resource to Xamarin.Form)

    • Add the image on top of the map:

      <Image x:Name="NorthArrow" />
      
    • Rotate the image when the view point changed:

      MapView.ViewpointChanged += (sender, args) =>
      {
          NorthArrow.Rotation = -MapView.MapRotation;
      };
      

    Complete solution here.