Change order of layer in map silverlight

3795
1
02-24-2015 07:11 AM
sakinachafaqi
New Contributor

Hello,

 

I want to order the layers that are displayed on my card, I wrote this code:

 

             ArcGISDynamicMapServiceLayer mapLayer1 = MyMap.Layers["Couches"] as ArcGISDynamicMapServiceLayer;
           
DynamicLayerInfoCollection myDynamicLayerInfos = (MyMap.Layers["Couches"] as ArcGISDynamicMapServiceLayer).DynamicLayerInfos;
            if (myDynamicLayerInfos == null)
                myDynamicLayerInfos = (MyMap.Layers["Couches"] as ArcGISDynamicMapServiceLayer).CreateDynamicLayerInfosFromLayerInfos();

            var aDynamicLayerInfo = myDynamicLayerInfos[0];
            myDynamicLayerInfos.RemoveAt(0);
            myDynamicLayerInfos.Add(aDynamicLayerInfo);
            int iLength = myDynamicLayerInfos.Count;
            LayerInfo[] l= new LayerInfo[iLength];
            for (int i = 0; i < myDynamicLayerInfos.Count;i++ )
            {
                (MyMap.Layers["Couches"] as ArcGISDynamicMapServiceLayer).Layers = (LayerInfo)myDynamicLayerInfos;
            }

            (MyMap.Layers["Couches"] as ArcGISDynamicMapServiceLayer).DynamicLayerInfos = null;
            (MyMap.Layers["Couches"] as ArcGISDynamicMapServiceLayer).DynamicLayerInfos = myDynamicLayerInfos;
                       
            (MyMap.Layers["Couches"] as ArcGISDynamicMapServiceLayer).Refresh();
           

 

 

But nothing has changed at my card. is what you have is why?

 

Thanks

0 Kudos
1 Reply
sakinachafaqi
New Contributor

I haven't the all layer are defaultvisible=true

Thanks

0 Kudos