MoveLayer not working as documented

879
1
Jump to solution
02-23-2017 05:41 PM
Highlighted
Regular Contributor

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)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
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

Reply
0 Kudos
1 Reply
Highlighted
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

Reply
0 Kudos