ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Layout Class / GroupElements Method
The elements to be grouped.
Example

In This Topic
    GroupElements Method (Layout)
    In This Topic
    Group the collection of elements. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GroupElements( _
       ByVal elements As IEnumerable(Of Element) _
    ) As GroupElement
    public GroupElement GroupElements( 
       IEnumerable<Element> elements
    )

    Parameters

    elements
    The elements to be grouped.

    Return Value

    GroupElement containing the grouped elements
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    elements cannot be null or empty
    elements must belong to layout 'URI'
    element parents must be the same and non-null
    Remarks
    If any group elements are present in the input collection, they must have the same parent or a element parents must be the same and non-null will be thrown.
    Example
    Group Graphic Elements
    {
      //Note: Must be on QueuedTask.Run
      var elemsToGroup = layout.GetSelectedElements();
      //Note: run within the QueuedTask
      //group  elements
      var newGroupElement = layout.GroupElements(elemsToGroup);
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also