How to change visibility of layer through code

03-06-2017 10:11 AM
Occasional Contributor II


We have developed a custom collection task for the ArcGIS Windows Mobile Application (v10.2.1). As part of the task workflow, we would like to switch on visibility of a particular layer on the map, which is not visible by default. 

We have tried setting the following properties, which all don't result in the layer displaying on the map:

  • FeatureSourceInfo.Visible = true.
  • CacheMapLayerInfo.Visible = true

I have also set a watch and toggled the visibility of the layer manually in the "Layer Visibility" dialog while debugging and the values for the above properties are the same regardless of whether the layer is turned on/off in the dialog. 

So my question is, which property controls the visibility of an individual layer in the map? Which property is the OOB Layer Visibility dialog changing?

I'm hoping someone has solved this before as it's such a common requirement. 

Any help greatly appreciated.



0 Kudos
1 Reply
Occasional Contributor II

After a lot of digging and experimentation, it seems the following sets the layer's visibility successfully:

FeatureSourceInfo.MobileCacheMapLayerDefinition.Visibility = true
0 Kudos