ArcGIS Pro 3.7 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 Function GetParent( _
       Optional ByVal topMost As Boolean _
    ) As IElementContainer
    public IElementContainer GetParent( 
       bool topMost
    )

    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
                                                             //will be a GraphicsLayer or Layout
      var top_most = groupElement.Elements.First().GetParent(true);
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also