ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / LayoutFrameworkExtender Class / CreateLayoutPaneAsync Method
Does not need to be specified.
Layout
Example

In This Topic
    CreateLayoutPaneAsync Method
    In This Topic
    Create and activate a new layout pane using a Layout reference. Must be called on GUI thread.
    Syntax
    Public Shared Function CreateLayoutPaneAsync( _
       ByVal paneCollection As PaneCollection, _
       ByVal layout As Layout _
    ) As Task(Of ILayoutPane)
    public static Task<ILayoutPane> CreateLayoutPaneAsync( 
       PaneCollection paneCollection,
       Layout layout
    )

    Parameters

    paneCollection
    Does not need to be specified.
    layout
    Layout

    Return Value

    Exceptions
    ExceptionDescription
    Must be called on GUI thread
    Remarks
    Be sure to call this on the GUI thread. Do not execute within a QueuedTask.Run block.
    Example
    Open a layout project item in a new view
    {
      //Open a layout project item in a new view.
      //A layout project item may exist but it may not be open in a view. 
    
      //Reference a layout project item by name
      LayoutProjectItem layoutItemByName = Project.Current.GetItems<LayoutProjectItem>()
                                .FirstOrDefault(item => item.Name.Equals("MyLayoutItem"));
    
      //Get the layout associated with the layout project item
      //Note: Needs QueuedTask to run
      Layout layoutFromItem = layoutItemByName.GetLayout();  //Worker thread
    
      //Create the new pane - call on UI
      ILayoutPane iNewLayoutPane = await ProApp.Panes.CreateLayoutPaneAsync(layout); //GUI thread
    }
    Create a new, basic layout and open it
    {
      //Create a new, basic layout and open it.
      //Create layout with minimum set of parameters on the worker thread
      //Note: Needs QueuedTask to run
      var myNewLayout = LayoutFactory.Instance.CreateLayout(8.5, 11, LinearUnit.Inches);
      myNewLayout.SetName("New 8.5x11 Layout");
    
      //Open new layout on the GUI thread
      await ProApp.Panes.CreateLayoutPaneAsync(myNewLayout);
    }
    Create a new layout using a modified CIM and open it
    {
      //Create a new layout using a modified CIM and open it.
      //The CIM exposes additional members that may not be
      //available through the managed API.  
      //In this example, optional guides are added.
      //Create a new CIMLayout on the worker thread
    
      //Note: Needs QueuedTask to run
      //Set up a CIM page
      CIMPage newPage = new CIMPage
      {
        //required parameters
        Width = 8.5,
        Height = 11,
        Units = LinearUnit.Inches,
    
        //optional rulers
        ShowRulers = true,
        SmallestRulerDivision = 0.5,
    
        //optional guides
        ShowGuides = true
      };
      CIMGuide guide1 = new CIMGuide
      {
        Position = 1,
        Orientation = Orientation.Vertical
      };
      CIMGuide guide2 = new CIMGuide
      {
        Position = 6.5,
        Orientation = Orientation.Vertical
      };
      CIMGuide guide3 = new CIMGuide
      {
        Position = 1,
        Orientation = Orientation.Horizontal
      };
      CIMGuide guide4 = new CIMGuide
      {
        Position = 10,
        Orientation = Orientation.Horizontal
      };
    
      List<CIMGuide> guideList = new List<CIMGuide>
      {
        guide1,
        guide2,
        guide3,
        guide4
      };
      newPage.Guides = guideList.ToArray();
    
      //Construct the new layout using the customized cim definitions
      var layout_local = LayoutFactory.Instance.CreateLayout(newPage);
      layout_local.SetName("New 8.5x11 Layout");
    
      //Open new layout on the GUI thread
      await ProApp.Panes.CreateLayoutPaneAsync(layout_local);
    
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also