ServiceManager.Publish<TServiceType> 方法 (TServiceType)

发布指定类型的指定服务实例。

命名空间:  Microsoft.Windows.Design
程序集:  Microsoft.Windows.Design.Extensibility(在 Microsoft.Windows.Design.Extensibility.dll 中)

语法

声明
Public Sub Publish(Of TServiceType) ( _
    serviceInstance As TServiceType _
)
public void Publish<TServiceType>(
    TServiceType serviceInstance
)
public:
generic<typename TServiceType>
void Publish(
    TServiceType serviceInstance
)
member Publish : 
        serviceInstance:'TServiceType -> unit 
JScript 不支持泛型类型或方法。

类型参数

  • TServiceType

参数

  • serviceInstance
    类型:TServiceType
    服务的实例。

异常

异常 条件
ArgumentNullException

serviceInstance 为 nullnull 引用(在 Visual Basic 中为 Nothing)。

备注

EditingContext 中创建服务之后,该服务将始终存在。 服务不能从 EditingContext 中移除。

.NET Framework 安全性

请参见

参考

ServiceManager 类

Publish 重载

Microsoft.Windows.Design 命名空间

EditingContext

ContextItem

Unsubscribe

Subscribe

其他资源

WPF 设计器扩展性