ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / Active Property
Example

In This Topic
    Active Property (MapView)
    In This Topic
    Gets the active map view. Returns null if there is no active map view.
    Syntax
    public static MapView Active {get;}
    Public Shared ReadOnly Property Active As MapView
    Example
    Get the active map
    Map map = MapView.Active.Map;
    Rotate Map View Asynchronous
    public void RotateView(double heading)
    {
      //Get the active map view.
      var mapView = MapView.Active;
      if (mapView == null)
        return;
    
      //Get the camera for the view, adjust the heading and zoom to the new camera position.
      var camera = mapView.Camera;
      camera.Heading = heading;
      mapView.ZoomToAsync(camera, TimeSpan.Zero);
    }
    Get the active map's name
    public string GetActiveMapName()
    {
      //Get the active map view.
      var mapView = MapView.Active;
      if (mapView == null)
        return null;
    
      //Return the name of the map currently displayed in the active map view.
      return mapView.Map.Name;
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also