Forum Xamarin.Forms

[Maps] Make Centering on the User an Optional Behavior

JimmyGarridoJimmyGarrido USXamarin Team Xamurai

Summary

On Windows, IsShowingUser will automatically zoom and center the map onto the user's location when it is first received. This does not appear to happen on iOS and Android.

API Changes

New

ShouldCenterOnUser

This bool determines whether the map should be centered on the user upon receiving their location if IsShowingUser is set to true.

var myMap = new Map {
  IsShowingUser = true,
  ShouldCenterOnUser = true
};

Intended Use Case

Since the user's location is not exposed unless one uses a plugin or DI, there is no quick and simple way to do this on Android and iOS if you want to initially center the map on the user. This behavior may or may not be desired so it should be available and configurable for all platforms.

Tagged:

Open · Last Updated

Sign In or Register to comment.