Share via


bindable

指示该属性支持数据绑定。

语法

[bindable]

备注

bindable C++ 属性与 bindable MIDL 属性具有相同的功能。 可以在使用 propgetpropputpropputref 特性定义的属性上使用它,也可以手动定义 bindable 方法。

以下 MFC 示例演示了 bindable 的用法:

示例

以下代码演示如何对属性使用 bindable

// 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") ];

要求

特性上下文
适用于 接口方法
可重复
必需的特性
无效的特性

有关特性上下文的详细信息,请参见 特性上下文

另请参阅

IDL 特性
方法特性
defaultbind
displaybind
immediatebind
requestedit