UIHierarchy.GetItem Method

Gets the item designated by given path.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

UIHierarchyItem GetItem (
	[InAttribute] string Names
)
UIHierarchyItem GetItem (
	/** @attribute InAttribute() */ String Names
)
function GetItem (
	Names : String
) : UIHierarchyItem

Parameters

Names

Required. The names in order from the root leading to subsequent subnodes. The last name in the array is the node returned as a UIHierarchyItem object.

Return Value

A UIHierarchyItem object.

The path comprises node names separated by backslashes (\). If two backslashes are adjacent to one another, they are parsed as a single backslash character that is part of a node name and not a separator.

NoteNote

For details on another way to access nodes in a UIHierarchy, see UIHierarchy object.

Sub GetItemExample()
   Dim UIH As UIHierarchy = _
     DTE.Windows.Item(Constants.vsWindowKindMacroExplorer).Object
   Dim UIHItem As UIHierarchyItem = UIH.GetItem("Macros\Samples")

   UIHItem.Select(vsUISelectionType.vsUISelectionTypeSetCaret)
   If UIHItem.IsSelected = False Then
      If UIH.UIHierarchyItems.Expanded = True Then
         MsgBox("Node is expanded.")
      Else
         MsgBox("Node is not expanded.")
      End If
   End If
   UIH.SelectDown(vsUISelectionType.vsUISelectionTypeSelect, 2)
   UIH.DoDefaultAction()
   UIH.SelectDown(vsUISelectionType.vsUISelectionTypeSelect, 1)
   UIH.SelectUp(vsUISelectionType.vsUISelectionTypeExtend, 1)
End Sub

Community Additions

ADD
Show: