Window.ContextAttributes - свойство
Возвращает коллекцию ContextAttributes, которая позволяет клиентам автоматизации добавлять новые атрибуты к элементам, выделенным в настоящий момент в окне Динамическая справка, и предоставлять контекстную справку по дополнительным атрибутам.
Пространство имен: EnvDTE
Сборка: EnvDTE (в EnvDTE.dll)
Синтаксис
'Декларация
ReadOnly Property ContextAttributes As ContextAttributes
ContextAttributes ContextAttributes { get; }
property ContextAttributes^ ContextAttributes {
ContextAttributes^ get ();
}
abstract ContextAttributes : ContextAttributes with get
function get ContextAttributes () : ContextAttributes
Значение свойства
Тип: EnvDTE.ContextAttributes
Коллекция ContextAttributes.
Примеры
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);
}
Безопасность платформы .NET Framework
- Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Для получения дополнительной информации см. Использование библиотек из не вполне надежного кода.
См. также
Ссылки
Другие ресурсы
Практическое руководство. Компиляция и выполнение примеров кода модели объектов автоматизации