Compartir a través de


Window2.ContextAttributes (Propiedad)

Obtiene una colección de ContextAttributes que permite a los clientes de automatización agregar atributos nuevos a los elementos seleccionados en la ventana Ayuda dinámica y proporcionar ayuda contextual correspondiente a dichos atributos.

Espacio de nombres:  EnvDTE80
Ensamblado:  EnvDTE80 (en EnvDTE80.dll)

Sintaxis

'Declaración
ReadOnly Property ContextAttributes As ContextAttributes
    Get
ContextAttributes ContextAttributes { get; }
property ContextAttributes^ ContextAttributes {
    ContextAttributes^ get ();
}
abstract ContextAttributes : ContextAttributes
function get ContextAttributes () : ContextAttributes

Valor de propiedad

Tipo: EnvDTE.ContextAttributes
Colección de ContextAttributes.

Implementaciones

Window.ContextAttributes

Ejemplos

Este ejemplo muestra el atributo de contexto del Explorador de soluciones.

Para obtener más información sobre cómo ejecutar este ejemplo como un complemento, vea Cómo: Compilar y ejecutar los ejemplos de código del modelo de objetos de automatización.

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
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
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);
}

Seguridad de .NET Framework

Vea también

Referencia

Window2 Interfaz

ContextAttributes (Sobrecarga)

EnvDTE80 (Espacio de nombres)