This document is archived and information here might be outdated.  Recommended version.


IContentsView.SelectedItem Property (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (ArcMapUI)  

IContentsView.SelectedItem Property

The selected item (could be an enumerator).

[Visual Basic .NET]
Public Property SelectedItem As Object
[C#]
public object SelectedItem {get; set;}

Product Availability

Available with ArcGIS Desktop.

Description

This property is not functional for TOCSelectionView. When working with a TOCDisplayView or TOCCatalogView this property has several usages:

1. The property can be a single object of any of the following types:

IMap
ILayer
ILegendGroup
IWorkspace (source view only)
IDataset (source view only)
IStandaloneTable (source view only)

2. The property can be a Set of items of the types listed in 1. Only multiple items of the same type can be selected simultaneously, so when setting this property using a Set, the Set should contain items of the same type.

3. The property can be an array where the contents of the array represent the hierarchical path to a single selected item. This is common when a single legend class is selected.

For example: If Array(0)=pMap, Array(1)=pLayer, Array(2)=pLegendGroup, and Array(3)=n, then the selected item is the nth legend class in pLegendGroup. When setting or adding to the selection, pass higher-level objects (in this case the IMap and ILayer objects) to improve peformance.

4. The property can be an array which contains an array of the structure explained in 3. This is common when multiple legend classes are selected.

See Also

IContentsView Interface

.NET Snippets

Get Selected Geodataset in Contents View | Get Selected Feature Layer in Contents View | Get Selected Table in Contents View | Get FeatureClass of Selected Feature Layer in Contents View | Zoom to Active Layer in TOC

.NET Samples

Custom UI elements using add-ins (Code Files: ZoomToLayerButton) | Create a command by inheriting from BaseCommand (Code Files: ZoomToLayer)

.NET Related Topics

Create a command by inheriting from BaseCommand