ArcGIS Pro 2.8 API Reference Guide
LayoutView Class
Members  Example 

ArcGIS.Desktop.Layouts Namespace : LayoutView Class
Represents the view of layout in a pane.
Object Model
LayoutView ClassLayoutView ClassMapFrame ClassCoordinate2D StructureEnvelope ClassLayout ClassCoordinate2D Structure
Syntax
public sealed class LayoutView 
Public NotInheritable Class LayoutView 
Remarks

A project can contain multiple layouts. A layout view is a pane that displays the view of a layout. Layout views are the primary interface used to display, navigate, and select layout elements. The layout being visualized in the view can be accessed via the Layout property.

There can be multiple layout views open at a given time, but there can only be one active layout view. The active layout view will set the context for the ribbon and many of the dock panes in the application. The Active property will return null if there is no active layout view.

The layout view has several "ZoomTo" nagivation methods and it also provides the context for managing selected items in the Contents pane. For example, the GetSelectedElements method returns a collection of selected page layout elements.

Example
The following examples demonstrate different ways of working with layout views.
//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
//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) //if there is a match, activate the view
  {
    (layoutPane as Pane).Activate();
    return;
  }
}
//Reference the active layout view.

//Confirm if the current, active view is a layout view.  If it is, do something.
LayoutView activeLayoutView = LayoutView.Active;
if (activeLayoutView != null)
{
  // do something
}
//This example references the active layout view.  Next it finds a couple of elements and adds them to a collection. 
//The elements in the collection are selected within the layout view.  Finally, the layout view is zoomed to the
//extent of the selection.

// Make sure the active pane is a layout view and then reference it
if (LayoutView.Active != null)
{
  LayoutView lytView = LayoutView.Active;
  //Reference the layout associated with the layout view
  Layout lyt = await QueuedTask.Run(() => lytView.Layout);

  //Find a couple of layout elements and add them to a collection
  Element map1 = lyt.FindElement("Map1 Map Frame");
  Element map2 = lyt.FindElement("Map2 Map Frame");
  List<Element> elmList = new List<Element>();
  elmList.Add(map1);
  elmList.Add(map2);

  //Set the selection on the layout view and zoom to the selected elements
  await QueuedTask.Run(() => lytView.SelectElements(elmList));
  await QueuedTask.Run(() => lytView.ZoomToSelectedElements());
}
Inheritance Hierarchy

System.Object
   ArcGIS.Desktop.Layouts.LayoutView

Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

LayoutView Members
ArcGIS.Desktop.Layouts Namespace