reneecammarere

How to collapse a layer in the TOC programmatically

Discussion created by reneecammarere on Mar 9, 2011
Latest reply on Mar 9, 2011 by ymanickam-esristaff
In the following snippit of code, I am attempting to collapse a layer in the TOC.  However, this doesn't seem to be working. Is there a way to do that?

            IMap aMap = axMapControl1.ActiveView.FocusMap;
            ILayer pLayer = aMap.get_Layer(0);
            INALayer2 anNALyr = (INALayer2)pLayer;
            anNALyr.Expanded = false;
            axTOCControl1.Refresh();

Thanks!
Renee

Outcomes