This documentation is archived and is not being maintained.

UIHierarchyItem.UIHierarchyItems Property

Gets a collection representing children of the item.

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

UIHierarchyItems UIHierarchyItems { get; }
/** @property */
UIHierarchyItems get_UIHierarchyItems ()

function get UIHierarchyItems () : UIHierarchyItems

Property Value

A UIHierarchyItems collection.

public void UIHierarchyItemsExample(DTE2 dte)
{
    // NOTE: This example requires a reference to the 
    //       System.Text namespace.

    // Before running this example, open a project.
    StringBuilder sb = new StringBuilder();

    RecurseItems(dte.ToolWindows.SolutionExplorer.UIHierarchyItems, 
        0, sb);

    MessageBox.Show(
        "Solution Explorer contains the following items:\n\n" + 
        sb.ToString());
}

void RecurseItems(UIHierarchyItems items, int level, StringBuilder sb)
{
    foreach (UIHierarchyItem item in items)
    {
        // Add item to the list of names.
        sb.Append(' ', level * 8);
        sb.Append(item.Name + "\n");

        RecurseItems(item.UIHierarchyItems, level + 1, sb);
    }
}
Show: