UIHierarchy.GetItem Method

Gets the item designated by given path.

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

Syntax

'Declaration
Function GetItem ( _
    Names As String _
) As UIHierarchyItem
UIHierarchyItem GetItem(
    string Names
)
UIHierarchyItem^ GetItem(
    [InAttribute] String^ Names
)
abstract GetItem : 
        Names:string -> UIHierarchyItem
function GetItem(
    Names : String
) : UIHierarchyItem

Parameters

  • Names
    Type: System.String

    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

Type: EnvDTE.UIHierarchyItem
A UIHierarchyItem object.

Remarks

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.

Note

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

Examples

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

.NET Framework Security

See Also

Reference

UIHierarchy Interface

EnvDTE Namespace

Other Resources

How to: Manipulate Tree Views by Using UIHierarchy