ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping.DeviceLocation Namespace / MapDeviceLocationOptions Class / MapDeviceLocationOptions Constructor
Example

In This Topic
    MapDeviceLocationOptions Constructor
    In This Topic
    Create a new MapDeviceLocationOptions instance.
    Syntax
    public MapDeviceLocationOptions()
    Public Function New()
    Remarks
    Use this with SetDeviceLocationOptions to update the current device location source with new options.
    Example
    Set Current Map Device Location Options
    //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
      });
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also