ZoomOrPanToCurrentLocation Method (MapDeviceLocationService)
Zooms or pans the active map view to the current location, keeping the current device location at the center.
This method must be called on the MCT. Use QueuedTask.Run.
Zoom/Pan The Map To The Most Recent Location
//Must be on the QueuedTask.Run()
if (!MapDeviceLocationService.Instance.IsDeviceLocationEnabled)
//Calling ZoomOrPanToCurrentLocation w/ no Device Location Enabled
//Will throw an InvalidOperationException
return;
// true for zoom, false for pan
MapDeviceLocationService.Instance.ZoomOrPanToCurrentLocation(true);
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.