TOCControl metadata viewer


Purpose
This sample describes how to use the TOCControl to access a layer on the PageLayoutControl to show its metadata within a Web Browser control. The metadata Extensible Markup Language (XML) is transformed using the selected style sheet provided by the sample.

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. Load a map document into the PageLayoutControl.
  2. Select a style sheet or type the style sheet's file path.
  3. Right-click a layer on the TOCControl to show its metadata.

Additional information

A browse dialog box allows you to search and select map documents (*.mxd) that are validated and loaded into the PageLayoutControl using the CheckMxFile and LoadMxFile methods. The ITOCControl.HitTest method is used in the ITOCControlEvents.OnMouseDown event when right-clicked to determine if a layer has been clicked.
If the layer is an IDataLayer, the metadata is retrieved using the IMetadata.Metadata property. The IXmlPropertySet2.SaveAsFile method is used to create a temporary metadata.htm file in the same folder as the sample code. The metadata.htm file contains the metadata XML transformed using the selected style sheet. The Web Browser control is used to show this file.


AssemblyInfo.cs Assembly information.
MetadataViewer.cs Form file.
Download the C# files
AssemblyInfo.vb Assembly information.
MetadataViewer.vb Form file.
Download the VB.NET files

Download the files for all languages

See Also:

TOCControl class
ITOCControl interface




Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced