ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Layout Class / Elements Property
Example Version

Elements Property (Layout)
Gets the collection of elements in a GroupElement.
Syntax

Property Value

Type: ReadOnlyCollectionBase
Example
Find an element on a layout
//Find an element on a layout.

// Reference a layout project item by name
LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("MyLayout"));
if (layoutItem != null)
{
  QueuedTask.Run(() =>
  {
    // Reference and load the layout associated with the layout item
    Layout mylayout = layoutItem.GetLayout();
    if (mylayout != null)
    {
      //Find a single specific element
      Element rect = mylayout.FindElement("Rectangle") as Element;

      //Or use the Elements collection
      Element rect2 = mylayout.Elements.FirstOrDefault(item => item.Name.Equals("Rectangle"));
    }
  });
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also