SelectedItem.ProjectItem Propriedade

Definição

Obtém o ProjectItem objeto associado ao objeto fornecido.Gets the ProjectItem object associated with the given object.

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

Valor da propriedade

ProjectItem

Um objeto ProjectItem.A ProjectItem object.

Atributos

Exemplos

public void CodeExample(DTE2 dte)  
{    
    try  
    {  
        // Open project and select one or more items in the  
        // solution explorer before running this example.  
        SelectedItem selItem;  
        string msg = "";  
        if (dte.SelectedItems.Count > 0)  
        {  
            selItem = dte.SelectedItems.Item(1);  
            msg = "The first selected item is " + selItem.Name;  
            msg += "\nThis SelectedItem corresponds to the following ProjectItem: " + selItem.ProjectItem.Name;  
            msg += "\nThis SelectedItem is part of a collection of " + selItem.Collection.Count.ToString() + " items.";  
            msg += "\nThis is contained in the following application: " + selItem.DTE.Name;  
        }  
        MessageBox.Show(msg);  
    }  
    catch(Exception ex)  
    {  
        MessageBox.Show(ex.Message);  
    }  
}  

Aplica-se a