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

IContentsView.ContextItem Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > ArcMapUI > ESRI.ArcGIS.ArcMapUI > Interfaces > IC > IContentsView Interface > IContentsView.ContextItem Property
ArcGIS Developer Help

IContentsView.ContextItem Property

The context item (could be an enumerator).

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

Product Availability

Available with ArcGIS Desktop.


You need at least to write a minimalistic implementation of this property as shown here:

Private m_ContextItem as Variant

Private Property Let IContentsView_ContextItem(ByVal RHS As Variant)
  m_ContextItem = RHS
End Property

Private Property Get IContentsView_ContextItem() As Variant
  IContentsView_ContextItem = m_ContextItem
End Property

The ContextItem property will contain the item on which the user makes a right-click in the TOC and at this point a context menu may be shown.

At 9.0 a default context menu is shown when the user right-clicks in your custom TOC. If you need to get rid of this menu in order to implement your own you will find the Selectable Layers Tab example valuable.

See Also

IContentsView Interface