Sdílet prostřednictvím


ToolWindows.SolutionExplorer Property

Definition

Gets a UIHierarchy object representing Solution Explorer.

public:
 property EnvDTE::UIHierarchy ^ SolutionExplorer { EnvDTE::UIHierarchy ^ get(); };
public:
 property EnvDTE::UIHierarchy ^ SolutionExplorer { EnvDTE::UIHierarchy ^ get(); };
[System.Runtime.InteropServices.DispId(8)]
public EnvDTE.UIHierarchy SolutionExplorer { [System.Runtime.InteropServices.DispId(8)] get; }
[<System.Runtime.InteropServices.DispId(8)>]
[<get: System.Runtime.InteropServices.DispId(8)>]
member this.SolutionExplorer : EnvDTE.UIHierarchy
Public ReadOnly Property SolutionExplorer As UIHierarchy

Property Value

A UIHierarchy object.

Attributes

Examples

This example activates Solution Explorer, selects items in it, counts and displays the number of items in it, and then closes it. Open a project in the Visual Studio integrated development environment (IDE) before running this example.

Imports EnvDTE  
Imports EnvDTE80  
Public Sub SolExplorerManip(ByVal dte As DTE2)  
    ' Open a project in Visual Studio, before running this example.  
    Dim solExplorer As UIHierarchy  
    solExplorer = dte.ToolWindows.SolutionExplorer  
    MsgBox("Activating Solution Explorer...")  
    solExplorer.Parent.Activate()  
    MsgBox("Seleting some items in Solution Explorer...")  
    solExplorer.SelectDown(vsUISelectionType.vsUISelectionTypeExtend, _  
    2)  
    MsgBox("The count of items in Solution Explorer is: "  _  
    & solExplorer.Parent.Collection.Count.ToString())  
    MsgBox("Closing Solution Explorer." & vbCr & _  
    "If you made changes you will be prompted to save.")  
    solExplorer.Parent.Close(vsSaveChanges.vsSaveChangesPrompt)  
End Sub  
using EnvDTE;  
using EnvDTE80;  
using System.Windows.Forms;  
public void SolExplorerManip(DTE2 dte)  
    {  
    // Open a project in Visual Studio, before running this example.  
    UIHierarchy solExplorer;  
    solExplorer = _applicationObject.ToolWindows.SolutionExplorer;  
    MessageBox.Show("Activating Solution Explorer...");  
    solExplorer.Parent.Activate();  
    MessageBox.Show("Seleting the first two items in   
Solution Explorer...");  
    solExplorer.SelectDown(vsUISelectionType.vsUISelectionTypeExtend,  
 2);  
    MessageBox.Show("The count of items in Solution Explorer is: "  
 + solExplorer.Parent.Collection.Count.ToString());  
    MessageBox.Show("Closing Solution Explorer." + "\n" +   
"If you made changes you will be prompted to save.");  
    solExplorer.Parent.Close(vsSaveChanges.vsSaveChangesPrompt);  
}  

Applies to