//Must be on the QueuedTask.Run() //Check there is a source first... if (DeviceLocationService.Instance.GetSource() == null) //Setting DeviceLocationOptions w/ no Device Location Source //Will throw an InvalidOperationException return; var map = MapView.Active.Map; if (!MapDeviceLocationService.Instance.IsDeviceLocationEnabled) //Setting DeviceLocationOptions w/ no Device Location Enabled //Will throw an InvalidOperationException return; MapDeviceLocationService.Instance.SetDeviceLocationOptions( new MapDeviceLocationOptions() { DeviceLocationVisibility = true, NavigationMode = MappingDeviceLocationNavigationMode.KeepAtCenter, TrackUpNavigation = true });
Target Platforms: Windows 11, Windows 10, Windows 8.1