ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / FrameworkExtender Class / CreateMapPaneAsync Method / CreateMapPaneAsync(PaneCollection,CIMMapView) Method
The project's collection of panes returned from ArcGIS.Desktop.Framework.FrameworkApplication.Panes.
Definition of a ArcGIS.Desktop.Mapping.MapView.
Example

In This Topic
    CreateMapPaneAsync(PaneCollection,CIMMapView) Method
    In This Topic
    Create and activate a new map pane which is a container for a ArcGIS.Desktop.Mapping.MapView.
    Syntax
    Public Overloads Shared Function CreateMapPaneAsync( _
       ByVal paneCollection As PaneCollection, _
       ByVal mapView As CIMMapView _
    ) As Task(Of IMapPane)
    public static Task<IMapPane> CreateMapPaneAsync( 
       PaneCollection paneCollection,
       CIMMapView mapView
    )

    Parameters

    paneCollection
    The project's collection of panes returned from ArcGIS.Desktop.Framework.FrameworkApplication.Panes.
    mapView
    Definition of a ArcGIS.Desktop.Mapping.MapView.

    Return Value

    A Task returning a map pane.
    Remarks
    When a new map pane is created the ArcGIS.Desktop.Mapping.MapView needs to initialize before any operations are performed on it. Be sure to await the Task to ensure the view has finished its initialization before performing any interactive or navigation operations on the resulting ArcGIS.Desktop.Mapping.MapView.
    Example
    Find a map within a project and open it
    {
        //Finding the first project item with name matches with mapName
        MapProjectItem? mpi = Project.Current.GetItems<MapProjectItem>()
          .FirstOrDefault(m => m.Name.Equals("The Map", StringComparison.CurrentCultureIgnoreCase));
        //Note: Needs QueuedTask to run
        var mapFromItem = mpi?.GetMap();
        if (mapFromItem != null)
        {
            //Open the map in a new map pane
            //Must be called from the UI thread
            await ProApp.Panes.CreateMapPaneAsync(map);
        }
    }
    Open a webmap
    {
        //Assume we get the selected webmap from the Project pane's Portal tab
        if (Project.Current.SelectedItems.Count > 0)
        {
            if (MapFactory.Instance.CanCreateMapFrom(Project.Current.SelectedItems[0]))
            {
                map = MapFactory.Instance.CreateMapFromItem(Project.Current.SelectedItems[0]);
                await ProApp.Panes.CreateMapPaneAsync(map);
            }
        }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also