In this section:
The table of contents (TOC) window in ArcMap provides users with a graphical interface, allowing them to interact with the layers in a map. The TOC appears adjacent to the main map window by default and contains a number of different views, which are viewed one at a time by selecting the tabs at the bottom of the TOC.
ArcMap has three different table of contents views.
Using the ArcMap default settings, the TOC window is always displayed when you open ArcMap. The views shown in this TOC window will depend on whether a new document is created or an existing document is opened.
By default, the Display, Source and Selection table of contents views are visible.
TOC views in a new document
If you start a new ArcMap session without loading an existing map document, the application reads from the Normal.mxt template, which will load the default views. All views can also be toggled on or off if necessary.
TOC views in an existing document
If you start ArcMap and load an existing map document or template, the default settings stored in the Normal.mxt file are overridden, and all of the views present when the document was saved will be shown. Therefore, if three views were open (for example, Display, Source, and Selection) when the document was last saved, all three views will be visible.
A document saves which views are currently visible.
The TOC in ArcMap is displayed by the TOCDockableWindow coclass. Each TOC view is not responsible for adding a tab window to the TOCDockableWindow; rather, it must create the client window that will be displayed inside the tab in the TOC window.
The basic properties of each view are controlled by the TOCPropertyPage, which you can open by clicking the Tools menu, then clicking Options. This page provides users with the functionality to change the visible TOC views as well as the font, patch style, and patch sizes used to display the items in the TOC.
The TOCPropertyPage displays the TOC options and allows you to specify whether or not each view is visible.
A custom TOC view is an application-level customization which affects many parts of the application framework. The customization should not change the default behavior of the ArcGIS applications in general.
A custom TOC view is an application-level customization. See Chapter 3 for more information on general application customization rules.
The status of the application can change during the application, for example, in response to user events such as opening and loading new documents. Users may also change from the map view to the page layout view.
Your TOC view should, therefore, be robust enough to handle both map and page layout view, and handle the opening of existing documents and the creation of new documents. It may need to react to certain events to handle these situationsyou may need to implement appropriate event interfaces to react to such changes.
A custom TOC view should handle both data view and page layout view. It should also handle the creation and opening of documents.
Every time ArcMap starts up, an instance of each different TOC view currently registered to ESRI Contents Views is automatically loaded and available for the duration of the application's execution. Ensure that your TOC view does not have code, which takes a particularly long time to execute at this point; test your component and consider caching or other techniques if required.
As a TOC view is around for the lifetime of the ArcMap application, ensure the application's performance is not degraded by the TOC view.
The existing Display and Source TOC views contain functionality that is generic in natureeach will work for any type of dataset that can be loaded into the document. Taking the Display view as an example, this view can render all the layer properties, such as the name, visibility, and symbology, regardless of the type of layer that was added to the map, including any special renderer symbols that have been applied. Furthermore, the views work the same whether ArcMap is currently displaying the data or page layout view.
The Selection view is slightly less generic in nature. It can display any selectable map layer and will safely handle and ignore any nonselectable layers.
To avoid any adverse behavior in the application, you should model your view after these generic designsyou must support or safely ignore any layer that can be loaded into ArcMap or opened from within a document. If your TOC iterates the layers in a map, never assume a layer's type.
A TOC view should be able to handle any kind of data that can be loaded into a map.
See Also CatalogView Example, Creating different kinds of TOC views, and Creating Cartography.