LookupBindingPropertiesAttribute クラス

定義

参照ベースのバインドをサポートするプロパティを指定します。 このクラスは継承できません。

public ref class LookupBindingPropertiesAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class LookupBindingPropertiesAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type LookupBindingPropertiesAttribute = class
    inherit Attribute
Public NotInheritable Class LookupBindingPropertiesAttribute
Inherits Attribute
継承
LookupBindingPropertiesAttribute
属性

次のコード例は、参照ベースのバインドで使用されるプロパティを示しています。

// The DemoControl class shows properties 
// used with lookup-based binding.
[LookupBindingProperties(
    "DataSource",
    "DisplayMember",
    "ValueMember",
    "LookupMember")]
public class DemoControl : Control;
' The DemoControl class shows properties 
' used with lookup-based binding.
<LookupBindingProperties( _
"DataSource", _
"DisplayMember", _
"ValueMember", _
"LookupMember")> _
Public Class DemoControl
    Inherits Control
End Class

LookupBindingPropertiesAttribute属性には、値の設定を解除する場合を除き、4 つのメンバーをすべて含める必要があります。 次のコード例は、 ComboBox コントロールを示しています。

// The DemoComboBox control shows a standard
// combo box binding definition.
[LookupBindingProperties(
    "DataSource",
    "DisplayMember",
    "ValueMember",
    "SelectedValue")]
public class DemoComboBox : Control;
' The DemoComboBox control shows a standard
' combo box binding definition.
<LookupBindingProperties( _
"DataSource", _
"DisplayMember", _
"ValueMember", _
"SelectedValue")> _
Public Class DemoComboBox
    Inherits Control
End Class

次のコード例は、コントロールが単純なバインドとリスト バインドの両方をサポートできることを示しています。

// The DemoComboBox2 class shows that a control can
// support both simple binding as well as list binding.
[LookupBindingProperties(
    "DataSource",
    "DisplayMember",
    "ValueMember",
    "SelectedValue")]
[DefaultBindingProperty("Text")]
public class DemoComboBox2 : Control;
' The DemoComboBox2 class shows that a control can
' support both simple binding as well as list binding.
<LookupBindingProperties( _
"DataSource", _
"DisplayMember", _
"ValueMember", _
"SelectedValue"), _
DefaultBindingProperty("Text")> _
Public Class DemoComboBox2
    Inherits Control
End Class

次のコード例は、引数を指定しないと、 LookupBindingPropertiesAttribute 属性を設定解除できることを示しています。

// NonBindableCombo control shows how to unset the
// LookupBindingProperties by specifying no arguments.
[LookupBindingProperties()]
public class NonBindableCombo : Control;
' NonBindableCombo control shows how to unset the
' LookupBindingProperties by specifying no arguments.
<LookupBindingProperties()>  _
Public Class NonBindableCombo
    Inherits Control
End Class

注釈

LookupBindingPropertiesAttributeは、参照ベースのバインディング (特にListBoxコントロールとComboBox コントロール) で使用されるプロパティを指定するために使用されます。

LookupBindingPropertiesAttributeはクラス レベルで指定されます。 クラスは継承でき、同じクラスで複数の属性を許可しません。

コンストラクター

名前 説明
LookupBindingPropertiesAttribute()

パラメーターを使用せず、 LookupBindingPropertiesAttribute クラスの新しいインスタンスを初期化します。

LookupBindingPropertiesAttribute(String, String, String, String)

LookupBindingPropertiesAttribute クラスの新しいインスタンスを初期化します。

フィールド

名前 説明
Default

LookupBindingPropertiesAttribute クラスの既定値を表します。

プロパティ

名前 説明
DataSource

LookupBindingPropertiesAttributeがバインドされているコンポーネントのデータ ソース プロパティの名前を取得します。

DisplayMember

LookupBindingPropertiesAttributeがバインドされているコンポーネントの表示メンバー プロパティの名前を取得します。

LookupMember

この属性がバインドされているコンポーネントの参照メンバーの名前を取得します。

TypeId

派生クラスで実装されている場合は、この Attributeの一意の識別子を取得します。

(継承元 Attribute)
ValueMember

LookupBindingPropertiesAttributeがバインドされているコンポーネントの値メンバー プロパティの名前を取得します。

メソッド

名前 説明
Equals(Object)

指定した Object が現在の LookupBindingPropertiesAttribute インスタンスと等しいかどうかを判断します。

GetHashCode()

このインスタンスのハッシュ コードを返します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされた場合、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラスでオーバーライドされた場合、このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

名前 説明
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

インターフェイスの型情報を取得するために使用できるオブジェクトの型情報を取得します。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されるプロパティとメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象

こちらもご覧ください