ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Element Class / ZOrder Property
Example

In This Topic
    ZOrder Property (Element)
    In This Topic
    Gets the Z order of the element relative to its parent
    Syntax
    public int ZOrder {get;}
    Public ReadOnly Property ZOrder As Integer

    Property Value

    O based Z order index
    Remarks
    A z-order of 0 is equivalent to the bottom. A z-order equal to the number of child elements (minus 1) is equivalent to the top (relative to its parent.)
    Example
    Get Z-Order
    var selElementsZOrder = graphicsLayer.GetSelectedElements();
    //list out the z order
    foreach (var elem in selElementsZOrder)
      System.Diagnostics.Debug.WriteLine($"{elem.Name}: z-order {elem.ZOrder}");
    Get Z-Order
    var selElementsZOrder = layout.GetSelectedElements();
    //list out the z order
    foreach (var elem in selElementsZOrder)
      //At 2.x - System.Diagnostics.Debug.WriteLine($"{elem.Name}: z-order {elem.GetZOrder()}");
      System.Diagnostics.Debug.WriteLine($"{elem.Name}: z-order {elem.ZOrder}");
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also