//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 = container.FindElement("Polygon 1");
var elem2 = container.FindElement("Bezier Text");
var elem3 = container.FindElement("Cloud Shape 2");
//Construct a list and add the elements
var elmList = new List<Element>
{
elem1,
elem2,
elem3
};
//Perform on the worker thread
await QueuedTask.Run(() =>
{
//At 2.x - GroupElement groupWithListOfElementsAtRoot =
// LayoutElementFactory.Instance.CreateGroupElement(layout, elmList);
//groupWithListOfElementsAtRoot.SetName("Group with list of elements at root");
//
GroupElement groupWithListOfElementsAtRoot =
ElementFactory.Instance.CreateGroupElement(
container, 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" };
//Perform on the worker thread
await QueuedTask.Run(() =>
{
//At 2.x - GroupElement groupWithListOfElementNamesAtRoot =
// LayoutElementFactory.Instance.CreateGroupElement(layout, elmNameList);
// groupWithListOfElementNamesAtRoot.SetName(
// "Group with list of element names at root");
//At 3.x, use the names to find the relevant elements first
//container is IElementContainer - GroupLayer or Layout
var elems = container.FindElements(elmNameList);
GroupElement groupWithListOfElementNamesAtRoot =
ElementFactory.Instance.CreateGroupElement(
container, elems, "Group with list of element names at root");
});