Hi,
I can do this manually but is there an easier way? Can either Container or Parent be made Public please?
public static GroupElement FindElementGroup(this Layout layout, Element elementToFind)
{
foreach (GroupElement groupElement in layout.GetNestedElements().OfType<GroupElement>().ToList())
{
if (groupElement.Elements.Any(element => element.Name.Equals(elementToFind.Name)))
{
return groupElement;
}
}
return null;
}
public static List<Element> GetNestedElements(this ILayoutElementContainer elementContainer)
{
List<Element> elements = elementContainer.Elements.ToList();
foreach (GroupElement groupElement in elementContainer.Elements.OfType<GroupElement>())
{
elements.AddRange(groupElement.GetNestedElements());
}
return elements;
}
Adam
At 2.6 (released yesterday), a new "GetParent" method is available on the Element class.