Select to view content in your preferred language

How to change the order of layers ?

555
1
12-14-2012 08:25 AM
FabienNAPPA
Regular Contributor
Hi all,

How to change the order of layers ?

I don't want to copy the graphics in temporary data and after to paste it, because I can do it.

Is it possible with an other solution ?

Thank you in advance,
Fabiano
0 Kudos
1 Reply
FabienNAPPA
Regular Contributor
The solution : MoveLayer

Note : Obviously there is a problem of refresh after using the MoveLayer class. The only solution is to finish the function with the instruction visible.

var myFeatureLayer = myMap.Layers["myLayerID"] as FeatureLayer;
var oldPosition = myMap.Layers.IndexOf(myFeatureLayer);
myMap.MoveLayer(oldPosition, oldPosition - 1);
if (myFeatureLayer.Visible == true){
myFeatureLayer.Visible = false;
myFeatureLayer.Visible = true;
}
0 Kudos