Layer filtering TOC view


PurposeThis sample shows an implementation of a custom table of contents (TOC) view that shows a tree view with map layers filtered by the layer type specified in a combo box. This sample also shows how to bring up an appropriate context menu when the data frame or layer tree node is right-clicked in the custom TOC.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Start Visual Studio, open the solution, and compile the project.
  2. Right-click the output .dll and register it.
  3. Start ArcMap and open a map.
  4. Select Layer Types (VB .NET) or Layer Types (C#) in the TOC.
  5. Select a layer type from the combo box to filter the layers in the TOC.
  6. Right-click a data frame node to show a context menu, which is the default.
  7. Right-click a layer node to show a simplified context menu containing the layer zoom in, open table, save to layer, and properties commands.

TOCFilterLayerContextMenu.cs Simplified layer context menu.
TOCLayerFilter.cs Custom contents view implementation.
Download the C# files
TOCFilterLayerContextMenu.vb Simplified layer context menu.
TOCLayerFilter.vb Custom contents view implementation.
Download the VB.NET files

Download the files for all languages




Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced