ArcGIS Pro 2.8 API Reference Guide
CreateGroupElement(ILayoutElementContainer,String[]) Method
Example 

ArcGIS.Desktop.Layouts Namespace > LayoutElementFactory Class > CreateGroupElement Method : CreateGroupElement(ILayoutElementContainer,String[]) Method
Layout or GroupElement
A string array that represents a list of element names.
Creates a group element using a list of element names. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Public Overloads Function CreateGroupElement( _
   ByVal elementContainer As ILayoutElementContainer, _
   ByVal elementNames() As String _
) As GroupElement

Parameters

elementContainer
Layout or GroupElement
elementNames
A string array that represents a list of element names.

Return Value

Returns a GroupElement.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Remarks
When the element container is a Layout then the element gets added to the root level of the layout TOC at the top most position.
Example
//Create a group using a list of element names at the root level of the contents pane.

//Build list of element names
var elmNameList = new[] { "Table Frame", "Chart Frame" };

//Construct on the worker thread
await QueuedTask.Run(() =>
{
  GroupElement groupWithListOfElementNamesAtRoot = LayoutElementFactory.Instance.CreateGroupElement(layout, elmNameList);
  groupWithListOfElementNamesAtRoot.SetName("Group with list of element names at root");
});
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

LayoutElementFactory Class
LayoutElementFactory Members
Overload List