ArcGIS Pro 3.2 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 GroupElement GroupElements( 
       IEnumerable<Element> elements
    )
    Public Function GroupElements( _
       ByVal elements As IEnumerable(Of Element) _
    ) As GroupElement

    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
    //on the QueuedTask
    var elemsToGroup = layout.GetSelectedElements();
    //Note: run within the QueuedTask
    //group  elements
    var groupElement = layout.GroupElements(elemsToGroup);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also