bindable

指示属性支持数据绑定。

[bindable]

备注

可绑定 C++ 特性具有与 可绑定 MIDL 属性相同。 您可以使用它在属性定义与 propgetpropputpropputref 属性,也可以手动定义一个可绑定方法。

下面的 MFC 示例演示如何使用 可绑定:

示例

下面的代码演示如何使用属性的 可绑定 :

// cpp_attr_ref_bindable.cpp
// compile with: /LD
#include <windows.h>
[
   uuid("479B29E3-9A2C-11D0-B696-00A0C903487A"),
   dispinterface,
   helpstring("property demo Interface")
]
__interface IPropDemo : IDispatch {

   [propget, id(1), bindable, displaybind, defaultbind, requestedit] HRESULT P1([out, retval] long *nSize);
   [propput, id(1), bindable, displaybind, defaultbind, requestedit] HRESULT P1([in] long nSize);
   [id(3), bindable, propget] HRESULT Object([out, retval] IDispatch **ppObj);
   [id(3), bindable, propputref] HRESULT Object([in] IDispatch* pObj);   
   [id(-552), helpstring("method AboutBox")] HRESULT AboutBox();
};

[ module(name="PropDemoLib", uuid="479B29E2-9A2C-11D0-B696-00A0C903487A", version="1.0", helpstring="property demo") ];

要求

属性上下文

适用对象

接口方法

可重复

必需的特性

无效的特性

有关属性上下文的更多信息,请参见 属性上下文

请参见

参考

defaultbind

displaybind

immediatebind

requestedit

其他资源

IDL 特性

方法特性

Attributes Samples