次の方法で共有


bindable

プロパティがデータ バインディングをサポートすることを示します。

構文

[bindable]

解説

bindable C++ 属性には、bindable MIDL 属性と同じ機能があります。 propgetpropput、または propputref の各属性で定義されたプロパティで使用することも、バインド可能なメソッドを手動で定義することもできます。

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

必要条件

属性コンテキスト Value
適用対象 インターフェイス メソッド
反復可能 いいえ
必要な属性 なし
無効な属性 なし

属性コンテキストの詳細については、「 属性コンテキスト」を参照してください。

関連項目

IDL 属性
メソッド属性
defaultbind
displaybind
immediatebind
requestedit