ArcGIS Pro 2.5 API Reference Guide
LayoutFrameworkExtender Class
Members  Example 

ArcGIS.Desktop.Core Namespace : LayoutFrameworkExtender Class
Contains extension methods to extend the PaneCollection class.
Public MustInherit NotInheritable Class LayoutFrameworkExtender 
public static class LayoutFrameworkExtender 
The class is primarily used to extend application panes that display the contents of a layout view. The same members will appear on both the extension class and the PaneCollection class.
//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 someLytItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("MyLayout"));

//Get the layout associated with the layout project item
Layout layout = await QueuedTask.Run(() => someLytItem.GetLayout());  //Worker thread

//Create the new pane
ILayoutPane iNewLayoutPane = await ProApp.Panes.CreateLayoutPaneAsync(layout); //GUI thread
//This sample checks to see if a layout project item already has an open application pane.  
//If it does, it checks if it is the active layout view, if not, it creates, activates and opens a new pane.

//Reference a layoutitem in a project by name
LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Layout View"));

//Get the layout associated with the layoutitem
Layout lyt = await QueuedTask.Run(() => layoutItem.GetLayout());
//Iterate through each pane in the application and check to see if the layout is already open and if so, activate it
foreach (var pane in ProApp.Panes)
  var layoutPane = pane as ILayoutPane;
  if (layoutPane == null)  //if not a layout pane, continue to the next pane
  if (layoutPane.LayoutView.Layout == lyt)  //if the layout pane does match the layout, activate it.
    (layoutPane as Pane).Activate();
    layoutPane.Caption = "This is a test";
//Otherwise, create, open, and activate the layout if not already open
ILayoutPane newPane = await ProApp.Panes.CreateLayoutPaneAsync(lyt);

//Zoom to the full extent of the layout
await QueuedTask.Run(() => newPane.LayoutView.ZoomTo100Percent());
//Find and close all layout panes associated with a specific layout.

LayoutProjectItem findLytItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Layout"));
Layout findLyt = await QueuedTask.Run(() => findLytItem.GetLayout());  //Perform on the worker thread

var panes = ProApp.Panes.FindLayoutPanes(findLyt);
foreach (Pane pane in panes)
  ProApp.Panes.CloseLayoutPanes(findLyt.URI);  //Close the pane
Inheritance Hierarchy



Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also


LayoutFrameworkExtender Members
ArcGIS.Desktop.Core Namespace