Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Gets a ContextAttributes collection which allows automation clients to add new attributes to the current, selected items in the Dynamic Help window and provide contextual help for additional attributes.
Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)
Syntax
'Declaration
ReadOnly Property ContextAttributes As ContextAttributes
ContextAttributes ContextAttributes { get; }
property ContextAttributes^ ContextAttributes {
    ContextAttributes^ get ();
}
abstract ContextAttributes : ContextAttributes
function get ContextAttributes () : ContextAttributes
Property Value
Type: EnvDTE.ContextAttributes
A ContextAttributes collection.
Implements
Examples
This example lists the context attribute for Solution Explorer.
For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.
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);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.