Select to view content in your preferred language

How to set visibility to certain layer and keep the rest layer's visibility?

702
2
04-06-2011 06:33 AM
weiliang
Deactivated User
Hi there,

In my code, I want to change the visibility of one single layer in a dynamic map service and keep the visibility of the rest layers in that map service the same as before. How could I fulfill it?

Many thanks for your help!

Wei
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
You can use this sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SubLayerList. If you know which sub layer you want to turn off, then make sure that you don't add it to your visibleLayers, regardless of the result of this check (layer.DefaultVisibility).
Skip the following lines for layer that you want to turn off.
   if (layerInfoArray[index].DefaultVisibility) 
                    visibleLayerIDList.Add(index); 
0 Kudos
weiliang
Deactivated User
Many thanks, Jennifer.

Wei
0 Kudos