ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / LayoutView Class / Layout Property
Example

In This Topic
    Layout Property (LayoutView)
    In This Topic
    Gets the layout associated with the layout view.
    Syntax
    public Layout Layout {get;}
    Public ReadOnly Property Layout As Layout
    Example
    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;
        }
      }
    }
    Set element selection
    {
      //Set the active layout view's selection to include 2 rectangle elements.
    
      //Reference the active view
      LayoutView activeLayoutView = LayoutView.Active;
      if (activeLayoutView != null)
      {
        await QueuedTask.Run(() =>
        {
          //Reference the layout
          Layout lyt = activeLayoutView.Layout;
    
        //Reference the two rectangle elements
        Element rec = lyt.FindElement("Rectangle");
        Element rec2 = lyt.FindElement("Rectangle 2");
    
        //Construct a list and add the elements
        List<Element> elmList = new List<Element>
        {
          rec,
          rec2
        };
        //Set the selection
          activeLayoutView.SelectElements(elmList);
        });
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also