ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Framework.Contracts Namespace / Pane Class / Activate Method
Example

In This Topic
    Activate Method (Pane)
    In This Topic
    Makes the Pane the active Pane and active window.
    Syntax
    Public Sub Activate() 
    public void Activate()
    Example
    Activate a pane
    {
      var mapPanes = FrameworkApplication.Panes.OfType<IMapPane>();
      foreach (Pane p in mapPanes.Cast<Pane>())
      {
        if (p.Caption == paneID)
        {
          p.Activate();
          break;
        }
      }
    }
    Find a MapView by its Caption
    {
      string mapPaneCaption = "USNationalParks";
      IMapPane mapViewPane = FrameworkApplication.Panes.OfType<IMapPane>().FirstOrDefault((p) => p.Caption == mapPaneCaption);
      mapView = null;
      if (mapViewPane != null)
      {
        // activate the MapPane
        (mapViewPane as Pane).Activate();
    
        if (mapView != null)
        {
          // get the layers selected in the map's TOC
          var selectedLayers = mapView.GetSelectedLayers();
        }
      }
    }
    Activate an already open report view
    {
      //Note: Needs QueuedTask to run
      Report reportToActivate = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault().GetReport();
      var reportPane = FrameworkApplication.Panes.FindReportPanes(report).Last();
      if (reportPane == null)
        return;
      //Activate the pane
      (reportPane as ArcGIS.Desktop.Framework.Contracts.Pane).Activate();
      //Get the "ReportView" associated with the Report Pane.
      ReportView reportViewFromPane = reportPane.ReportView;
    }
    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;
        }
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also