ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Element Class / GetParent Method
If true then the top most parent or 'container' is returned
Example

In This Topic
    GetParent Method (Element)
    In This Topic
    Gets the parent of this element.
    Syntax
    public IElementContainer GetParent( 
       bool topMost
    )
    Public Function GetParent( _
       Optional ByVal topMost As Boolean _
    ) As IElementContainer

    Parameters

    topMost
    If true then the top most parent or 'container' is returned

    Return Value

    Remarks
    Example
    Parent of GroupElement
    //check the parent
    var parent = groupElement.Elements.First().GetParent();//will be the group element
    //top-most parent
    var top_most = groupElement.Elements.First().GetParent(true);//will be the GraphicsLayer
    Parent of GroupElement
    //check the parent
    var parent = groupElement.Elements.First().GetParent();//will be the group element
    //top-most parent
    //will be a GraphicsLayer or Layout
    var top_most = groupElement.Elements.First().GetParent(true);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also