ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / IMapPane Interface
Members Example

In This Topic
    IMapPane Interface
    In This Topic
    Represents a pane which contains a map view.
    Object Model
    IMapPane InterfaceMapView ClassCIMMapView Class
    Syntax
    public interface IMapPane 
    Public Interface IMapPane 
    Example
    Get Map Panes
    public static IEnumerable<IMapPane> GetMapPanes()
    {
      //Sorted by Map Uri
      return ProApp.Panes.OfType<IMapPane>().OrderBy((mp) => mp.MapView.Map.URI ?? mp.MapView.Map.Name);
    }
    Get the Unique List of Maps From the Map Panes
    public static IReadOnlyList<Map> GetMapsFromMapPanes()
    {
      //Gets the unique list of Maps from all the MapPanes.
      //Note: The list of maps retrieved from the MapPanes
      //maybe less than the total number of Maps in the project.
      //It depends on what maps the user has actually opened.
      var mapPanes = ProApp.Panes.OfType<IMapPane>()
                  .GroupBy((mp) => mp.MapView.Map.URI).Select(grp => grp.FirstOrDefault());
      List<Map> uniqueMaps = new List<Map>();
      foreach (var pane in mapPanes)
        uniqueMaps.Add(pane.MapView.Map);
      return uniqueMaps;
    }
    Find a MapView by its Caption
    // find a mapview by its Caption using the FrameworkApplication Panes collection
    var mapPaneCaption = "USNationalParks";
    var mapViewPane = FrameworkApplication.Panes.OfType<IMapPane>().FirstOrDefault((p) => p.Caption == mapPaneCaption);
    if (mapViewPane != null)
    {
      // activate the MapPane
      (mapViewPane as Pane).Activate();
      var mapView = mapViewPane.MapView;
      if (mapView != null)
      {
        // get the layers selected in the map's TOC
        var selectedLayers = mapView.GetSelectedLayers();
      }
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also