Parameters
- enable
- Set to true to enable the current DeviceLocationSource. False to disable.
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
| System.InvalidOperationException | The active map view is null. |
| System.InvalidOperationException | A DeviceLocationSource must be open. |
Set MapDeviceLocationOptions.DeviceLocationVisibility = true to display the location on the map view when the device location source is enabled. Refer to SetDeviceLocationOptions.
{
bool enabled = MapDeviceLocationService.Instance.IsDeviceLocationEnabled;
await QueuedTask.Run(() =>
{
MapDeviceLocationService.Instance.SetDeviceLocationEnabled(!enabled);
});
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)