MoveLayer not working as documented

1412
1
Jump to solution
02-23-2017 05:41 PM
KirkKuykendall
Occasional Contributor III

The documentation for ILayerContainerEdit.MoveLayer says:

The position specified by the 0-based index. If the index is invalid, the layer is moved to the bottom.

However this code doesn't move the layer to the bottom:

 Dim srcLayer = MapView.Active.GetSelectedLayers()(0)
 MapView.Active.Map.MoveLayer(srcLayer, 999)

Only 3 layers are in the map.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
UmaHarano
Esri Regular Contributor

Hi Kirk,

The MoveLayer method does move the layer to the bottom if you pass in a valid index.

We will look into this! 

But in the meantime, this code snippet will help with moving the layer to the bottom:

var srcLayer = MapView.Active.GetSelectedLayers().FirstOrDefault();
            await QueuedTask.Run(() =>
            {
                MapView.Active.Map.MoveLayer(srcLayer, (MapView.Active.Map.Layers.Count - 1));
            });

Thanks!

Uma Harano

ArcGIS Pro SDK Team.

View solution in original post

0 Kudos
1 Reply
UmaHarano
Esri Regular Contributor

Hi Kirk,

The MoveLayer method does move the layer to the bottom if you pass in a valid index.

We will look into this! 

But in the meantime, this code snippet will help with moving the layer to the bottom:

var srcLayer = MapView.Active.GetSelectedLayers().FirstOrDefault();
            await QueuedTask.Run(() =>
            {
                MapView.Active.Map.MoveLayer(srcLayer, (MapView.Active.Map.Layers.Count - 1));
            });

Thanks!

Uma Harano

ArcGIS Pro SDK Team.

0 Kudos