Export (0) Print
Expand All

UIHierarchy.SelectUp Method

Selects the node immediately above the currently selected node with respect to the tree's current expansion state.

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

void SelectUp(
	vsUISelectionType How,
	int Count


Type: EnvDTE.vsUISelectionType

Required. A vsUISelectionType constant indicating how the selection is made.

Type: System.Int32

Required. The number of nodes to select up from the current node. Count is also used for coalescing commands while recording. That is, if you type SHIFT + UP ARROW four times, rather than four lines of code emitted, you instead get one line with a Count value of 4.

SelectUp is useful for SHIFT-click macro recording or to move down or up using the arrow keys. It is useful because the behavior of SelectUp mimics the behavior of using the ARROW and SHIFT+ARROW keys in a tree view.

Sub SelectUpExample()
   Dim UIH As UIHierarchy = _
   Dim UIHItem As UIHierarchyItem = UIH.GetItem("Macros\Samples")

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

© 2015 Microsoft