Create custom legend or contentview in dockable window

2582
0
08-21-2015 03:02 PM
JosephSaltenberger
New Contributor III

Any idea if you can hide any of the sections inside the table of contents using ArcObjects? I'm only interested in the 'List by Visibility section'. I have tried IContentsViewEdit, but doesn't seem to work in 10.X. Even better, I would like to re-create that ContentView in my own dockable window, if that's a possibility.

Another possibility would be to display ILegend in a dockable window. I'm successful in adding it to Layout View, but not a dockable window (see below).

  1. ILegend legend = new LegendClass_2(); 
  2. legend.AutoAdd = true
  3. legend.Title = "Test"
  4. legend.Map = mxdoc.FocusMap; 
  5.  
  6. IMapSurroundFrame MSFrame = new MapSurroundFrameClass(); 
  7. MSFrame.MapSurround = legend; 
  8.  
  9. IElement MSElement = MSFrame as IElement; 
  10. IEnvelope en = new EnvelopeClass(); 
  11. en.XMin = 1.5; en.YMin = 1.5
  12. en.Width = 10; en.Height = 10
  13. MSElement.Geometry = en as IGeometry; 
  14.  
  15. IGraphicsContainer gc = mxdoc.PageLayout as IGraphicsContainer; 
  16. gc.AddElement(MSElement, 0); 
  17.              
  18. mxdoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

Any suggestions on wither of these two methods would be great. Thanks

0 Kudos
0 Replies