{
//Create a group with a list of elements at the root level of the contents pane.
//Find an existing elements
//container is IElementContainer - GroupLayer or Layout
var elem1 = layout.FindElement("Polygon 1");
var elem2 = layout.FindElement("Bezier Text");
var elem3 = layout.FindElement("Cloud Shape 2");
//Construct a list and add the elements
var elmList = new List<Element>
{
elem1,
elem2,
elem3
};
//Note: Must be on QueuedTask.Run
GroupElement groupWithListOfElementsAtRoot =
ElementFactory.Instance.CreateGroupElement(
layout, elmList, "Group with list of elements at root");
// *** or ***
//Create a group using a list of element names at the root level of the contents pane.
//List of element names
var elmNameList = new[] { "Para Text1", "Line 3" };
//Note: Must be on QueuedTask.Run
var elemToGroup = layout.FindElements(elmNameList);
GroupElement groupWithListOfElementNamesAtRoot =
ElementFactory.Instance.CreateGroupElement(
layout, elemToGroup, "Group with list of element names at root");
}