共用方式為


UIHierarchyItems Interface

Definition

Represents a given level of the UI hierarchy tree. It also represents a collection of the selected items in the tree.

public interface class UIHierarchyItems : System::Collections::IEnumerable
[System.Runtime.InteropServices.Guid("DB8406B0-A916-449C-A277-BB04028F4394")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface UIHierarchyItems : System.Collections.IEnumerable
[System.Runtime.InteropServices.Guid("DB8406B0-A916-449C-A277-BB04028F4394")]
public interface UIHierarchyItems : System.Collections.IEnumerable
[<System.Runtime.InteropServices.Guid("DB8406B0-A916-449C-A277-BB04028F4394")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type UIHierarchyItems = interface
    interface IEnumerable
[<System.Runtime.InteropServices.Guid("DB8406B0-A916-449C-A277-BB04028F4394")>]
type UIHierarchyItems = interface
    interface IEnumerable
Public Interface UIHierarchyItems
Implements IEnumerable
Attributes
Implements

Examples

Sub UIHierarchyItemsExample()  
   ' Reference the UIHierarchy, UIHierarchyItem, and OutputWindow objects.  
   Dim UIH As UIHierarchy = _  
     DTE.Windows.Item(Constants.vsWindowKindMacroExplorer).Object  
   Dim samples As UIHierarchyItem = UIH.GetItem("Macros\Samples")  
   Dim OWPane As OutputWindowPane = GetOutputWindowPane("List Macros")  
   Dim file As UIHierarchyItem  

   OWPane.Clear()  
   For Each file In samples.UIHierarchyItems  
      OWPane.OutputString(file.Name &  _  
        Microsoft.VisualBasic.Constants.vbCrLf)  
      Dim macro As UIHierarchyItem  
      For Each macro In file.UIHierarchyItems  
         OWPane.OutputString("   " & macro.Name & _  
           Microsoft.VisualBasic.Constants.vbCrLf)  
      Next  
   Next  
End Sub  

Function GetOutputWindowPane(ByVal Name As String, Optional ByVal show _  
  As Boolean = True) As OutputWindowPane  
   Dim win As Window = _  
     DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)  
   If show Then win.Visible = True  
   Dim ow As OutputWindow = win.Object  
   Dim owpane As OutputWindowPane  
   Try  
      owpane = ow.OutputWindowPanes.Item(Name)  
   Catch e As System.Exception  
      owpane = ow.OutputWindowPanes.Add(Name)  
   End Try  
   owpane.Activate()  
   Return owpane  
End Function  

Remarks

For alternate ways to use the UIHierarchyItems collection to access nodes, see UIHierarchy object.

Properties

Count

Gets a value indicating the number of objects in the UIHierarchyItems collection.

DTE

Gets the top-level extensibility object.

Expanded

Sets or gets whether a node in the hierarchy is expanded.

Parent

Gets the immediate parent object of a UIHierarchyItems collection.

Methods

GetEnumerator()

Gets an enumeration for items in a collection.

Item(Object)

Returns a UIHierarchyItem object in a UIHierarchyItems collection.

Applies to