ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Framework Namespace / PaneCollection Class / ClosePane Method
Example

In This Topic
    ClosePane Method
    In This Topic
    Close the pane identified by the specified instance ID.
    Syntax
    public void ClosePane( 
       uint id
    )
    Public Sub ClosePane( _
       ByVal id As UInteger _
    ) 

    Parameters

    id
    Example
    Close a specific pane
    string _viewPaneID = "my pane"; //DAML ID of your pane
                                    //You could have multiple instances (InstanceIDs) of your pane. 
                                    //So you can iterate through the Panes to get "your" panes only
    IList<uint> myPaneInstanceIDs = new List<uint>();
    foreach (Pane pane in FrameworkApplication.Panes)
    {
      if (pane.ContentID == _viewPaneID)
      {
        myPaneInstanceIDs.Add(pane.InstanceID); //InstanceID of your pane, could be multiple, so build the collection                    
      }
    }
    foreach (var instanceID in myPaneInstanceIDs) //close each of "your" panes.
    {
      FrameworkApplication.Panes.ClosePane(instanceID);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also