ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Framework Namespace / FrameworkApplication Class / Panes Property
Example

In This Topic
    Panes Property
    In This Topic
    Gets all the active pane instances; this singleton also lets you activate, create, and close panes.
    Syntax
    public static PaneCollection Panes {get;}
    Public Shared ReadOnly Property Panes As PaneCollection
    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);
    }
    Activate a pane
    var mapPanes = ProApp.Panes.OfType<IMapPane>();
    foreach (Pane pane in mapPanes)
    {
      if (pane.Caption == "MyMap")
      {
        pane.Activate();
        break;
      }
    }
    Activate an already open layout view
    //Activate an already open layout view.
    //A layout view may be open but it may not be active.
    
    //Find the pane that references the layout and activate it. 
    //Note - there can be multiple panes referencing the same layout.
    foreach (var pane in ProApp.Panes)
    {
      var layoutPane = pane as ILayoutPane;
      if (layoutPane == null)  //if not a layout view, continue to the next pane
        continue;
      if (layoutPane.LayoutView.Layout == layout) //activate the view
      {
        (layoutPane as Pane).Activate();
        return;
      }
    }
    Change table View caption
    // find all the table panes (table panes hosting map data)
    var tablePanes = FrameworkApplication.Panes.OfType<ITablePane>();
    var tablePane = tablePanes.FirstOrDefault(p => (p as ITablePaneEx)?.Caption == "oldcCaption");
    var tablePaneEx = tablePane as ITablePaneEx;
    if (tablePaneEx != null)
      tablePaneEx.Caption = "newCaption";
    
    // find all the external table panes (table panes hosting external data)
    var externalPanes = FrameworkApplication.Panes.OfType<IExternalTablePane>();
    var externalTablePane = externalPanes.FirstOrDefault(p => p.Caption == "oldcCaption");
    if (externalTablePane != null)
      externalTablePane.Caption = "newCaption";
    Get TableView from table pane
    TableView tv = null;
    
    // find all the table panes (table panes hosting map data)
    var tablePanes = FrameworkApplication.Panes.OfType<ITablePane>();
    var tablePane = tablePanes.FirstOrDefault(p => (p as ITablePaneEx)?.Caption == "caption");
    var tablePaneEx = tablePane as ITablePaneEx;
    if (tablePaneEx != null)
      tv = tablePaneEx.TableView;
    
    // if it's not found, maybe it's an external table pane
    if (tv == null)
    {
      // find all the external table panes (table panes hosting external data)
      var externalPanes = FrameworkApplication.Panes.OfType<IExternalTablePane>();
      var externalTablePane = externalPanes.FirstOrDefault(p => p.Caption == "caption");
      if (externalTablePane != null)
        tv = externalTablePane.TableView;
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also