添加一个将在指定项类型的上下文项发生更改时进行调用的回调。
命名空间:  Microsoft.Windows.Design
程序集:  Microsoft.Windows.Design.Extensibility(在 Microsoft.Windows.Design.Extensibility.dll 中)
语法
声明
Public Sub Subscribe(Of TContextItemType As ContextItem) ( _
    callback As SubscribeContextCallback(Of TContextItemType) _
)
public void Subscribe<TContextItemType>(
    SubscribeContextCallback<TContextItemType> callback
)
where TContextItemType : ContextItem
public:
generic<typename TContextItemType>
where TContextItemType : ContextItem
void Subscribe(
    SubscribeContextCallback<TContextItemType>^ callback
)
member Subscribe : 
        callback:SubscribeContextCallback<'TContextItemType> -> unit  when 'TContextItemType : ContextItem
JScript 不支持泛型类型或方法。
类型参数
- TContextItemType
参数
- callback
 类型:Microsoft.Windows.Design.SubscribeContextCallback<TContextItemType>
 一个将在 ContextItemType 发生更改时进行调用的回调。
异常
| 异常 | 条件 | 
|---|---|
| ArgumentNullException | callback 为 nullnull 引用(在 Visual Basic 中为 Nothing)。 | 
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
SubscribeContextCallback<TContextItemType>