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


IMxDocument.SelectedItem Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > ArcMapUI > ESRI.ArcGIS.ArcMapUI > Interfaces > IM > IMxDocument Interface > IMxDocument.SelectedItem Property
ArcGIS Developer Help

IMxDocument.SelectedItem Property

The selected item in the layer control.

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

Product Availability

Available with ArcGIS Desktop.

Remarks

This property returns a reference to the currently selected item in the table of contents.  The return is an IUnknown because there are several possbile objects the selected item can be. 

When working in the Display tab, the reference could be to a Map object if you have a data frame selected, one of the Layer objects (FeatureLayer, FDOGraphicsLayer, etc) if you have a layer selected, or a LegendGroup if you have a unique value or heading selected.

In the Source tab, the reference can be to any of the above objects plus a Table, FeatureDataset, or Workspace.

In the case where more than one item is selected, the reference is to a Set object.

See Also

IMxDocument Interface