Condividi tramite


Proprietà Window.ContextAttributes

Aggiornamento: novembre 2007

Ottiene un insieme ContextAttributes che consente ai client di automazione di aggiungere nuovi attributi agli elementi selezionati nella finestra della Guida dinamica e di fornire la guida contestuale per gli attributi aggiuntivi.

Spazio dei nomi:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Sintassi

ReadOnly Property ContextAttributes As ContextAttributes

Dim instance As Window
Dim value As ContextAttributes

value = instance.ContextAttributes
ContextAttributes ContextAttributes { get; }
property ContextAttributes^ ContextAttributes {
    ContextAttributes^ get ();
}
function get ContextAttributes () : ContextAttributes

Valore proprietà

Tipo: EnvDTE.ContextAttributes

Insieme di ContextAttributes.

Esempi

Sub ContextAttributesExample(ByVal dte As DTE2)

    ' List the current context attributes associated with 
    ' Solution Explorer.
    Dim explorerWin As Window = dte.ToolWindows.SolutionExplorer.Parent
    Dim attrs As String
    Dim attr As ContextAttribute

    For Each attr In explorerWin.ContextAttributes
        attrs &= attr.Name & vbCrLf
    Next

    MsgBox("Solution Explorer has the following context attributes:" _
        & vbCrLf & vbCrLf & attrs)

    ' Associate a new F1 keyword with Solution Explorer.
    explorerWin.ContextAttributes.Add("ANewKeyword", "900", _
        vsContextAttributeType.vsContextAttributeLookupF1)

    attrs = ""
    For Each attr In explorerWin.ContextAttributes
        attrs &= attr.Name & vbCrLf
    Next

    MsgBox("Solution Explorer has the following context attributes:" _
        & vbCrLf & vbCrLf & attrs)

End Sub
public void ContextAttributeExample(DTE2 dte)
{
    // List the current context attributes associated with 
    // Solution Explorer.
    Window explorerWin = dte.ToolWindows.SolutionExplorer.Parent;
    string attrs = "";

    foreach (ContextAttribute attr in explorerWin.ContextAttributes)
        attrs += attr.Name + "\n";

    MessageBox.Show(
        "Solution Explorer has the following context attributes:\n\n" + 
        attrs);

    // Associate a new F1 keyword with Solution Explorer.
    explorerWin.ContextAttributes.Add("ANewKeyword", "900", 
        vsContextAttributeType.vsContextAttributeLookupF1);

    attrs = "";
    foreach (ContextAttribute attr in explorerWin.ContextAttributes)
        attrs += attr.Name + "\n";

    MessageBox.Show(
        "Solution Explorer has the following context attributes:\n\n" + 
        attrs);
}

Autorizzazioni

Vedere anche

Riferimenti

Window Interfaccia

Membri Window

Spazio dei nomi EnvDTE

Altre risorse

Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione