ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / MoveLayer Method / MoveLayer(Layer,GroupLayer,Int32) Method
A layer.
The layer container to move the layer to.
The position specified by the 0-based index. -1 will move the layer the bottom of the container. If the index is invalid, the layer is moved to the bottom of the container.

In This Topic
    MoveLayer(Layer,GroupLayer,Int32) Method
    In This Topic
    Moves a layer to a different position in the specified targetlayer container. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void MoveLayer( 
       Layer layer,
       GroupLayer targetLayer,
       int position
    )
    Public Overloads Sub MoveLayer( _
       ByVal layer As Layer, _
       ByVal targetLayer As GroupLayer, _
       ByVal position As Integer _
    ) 

    Parameters

    layer
    A layer.
    targetLayer
    The layer container to move the layer to.
    position
    The position specified by the 0-based index. -1 will move the layer the bottom of the container. If the index is invalid, the layer is moved to the bottom of the container.
    Exceptions
    ExceptionDescription
    The layer is null.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    If targetLayer is null, the layer is moved to the specified position within the map.
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also