ArcGIS Pro 2.6 API Reference Guide
CreateGroupElement(ILayoutElementContainer) Method
Example 

ArcGIS.Desktop.Layouts Namespace > LayoutElementFactory Class > CreateGroupElement Method : CreateGroupElement(ILayoutElementContainer) Method
Layout or GroupElement
Creates a group element with a no elements. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Public Overloads Function CreateGroupElement( _
   ByVal elementContainer As ILayoutElementContainer _
) As GroupElement

Parameters

elementContainer
Layout or GroupElement

Return Value

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


//Construct on the worker thread
await QueuedTask.Run(() =>
{
  GroupElement emptyGroupAtRoot = LayoutElementFactory.Instance.CreateGroupElement(layout);
  emptyGroupAtRoot.SetName("Empty group at root");
});
//Create an empty group element at the root level of another group element.

//Find an existing group element
GroupElement existingGroupAtRoot = layout.FindElement("Empty group at root") as GroupElement;

//Construct on the worker thread
await QueuedTask.Run(() =>
{
  GroupElement emptyGroupInGroupAtRoot = LayoutElementFactory.Instance.CreateGroupElement(existingGroupAtRoot);
  emptyGroupInGroupAtRoot.SetName("Empty group in group at root");
});
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

LayoutElementFactory Class
LayoutElementFactory Members
Overload List