Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

ILayer.Visible seems to have no effect - How can I manually manage layer visibility and actually get the map control to update?

ILayer lyr = mapControl.get_Layer(i);

//this works for custom layers that I define but not for Bing_Maps.lyr or ESRI .lyr files that comes with ArcEngine or connections to ArcGIS Online. For composite layers, I also tried iterating through sub layers and setting the visibility to false

lyr.Visible = false;
share|improve this question
are you refreshing or partially refreshing the active view's display? By "manually" do you mean programmatically? – Kirk Kuykendall Jan 19 '11 at 1:01
Can you share your code? ILayer.Visible Property is the one which is used for this, & is working for me. – Devdatta Tengshe Jan 19 '11 at 3:48
edited code formatting – Petr Krebs Jan 19 '11 at 15:59
I added more code and a better description to answer your questions. I did see another post about ILayerFile and noticed that this interface has no visibility property - would it have anything to do with that? – Darren Jan 24 '11 at 21:35
I experienced problems with layer visibility while using the DynamicDisplay functionality. – patrick Jun 14 '11 at 16:36

If the layer is added to a basemap layer you need to Notify the baselayer that a layer has changed to ensure that it recreate it's display cache: Accessing a basemap sublayer

share|improve this answer

If you're using a ITOCControl, you can take a look at this featureITOCControl.LayerVisibilityEdit Hope this helps

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.