6

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;
mapControl.Update();
mapControl.Refresh();
mapControl.ActiveView.Refresh();
mapControl.Invalidate();
Petr Krebs
10.3k1 gold badge24 silver badges33 bronze badges
asked Jan 19, 2011 at 0:25
7
  • 2
    are you refreshing or partially refreshing the active view's display? By "manually" do you mean programmatically? Commented Jan 19, 2011 at 1:01
  • Can you share your code? ILayer.Visible Property is the one which is used for this, & is working for me. Commented Jan 19, 2011 at 3:48
  • edited code formatting Commented Jan 19, 2011 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? Commented Jan 24, 2011 at 21:35
  • I experienced problems with layer visibility while using the DynamicDisplay functionality. Commented Jun 14, 2011 at 16:36

2 Answers 2

2

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

answered Jun 15, 2011 at 13:50
0

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

answered Jun 14, 2011 at 15:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.