BindableAttribute.Bindable Tulajdonság

Definíció

Lekéri azt az értéket, amely azt jelzi, hogy egy tulajdonságot általában a kötéshez használnak.

public:
 property bool Bindable { bool get(); };
public bool Bindable { get; }
member this.Bindable : bool
Public ReadOnly Property Bindable As Boolean

Tulajdonság értéke

trueha a tulajdonságot általában kötésre használják; egyéb esetben. false

Példák

Az alábbi példakód ellenőrzi, hogy van-e MyProperty kötés. Először a kód az alábbi műveletekkel kapja meg az attribútumokat MyProperty :

Ezután a kód a benne lévő myAttribute értékre BindableAttribute állítja AttributeCollection be a kódot, és ellenőrzi, hogy a tulajdonság köthető-e.

A példakód futtatásához meg kell adnia a teljes szerelvénynevet. További információ a teljes szerelvénynév beszerzéséről:

Szerelvénynevek.

// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes;

// Checks to see if the property is bindable.
BindableAttribute^ myAttribute = dynamic_cast<BindableAttribute^>(attributes[ BindableAttribute::typeid ]);
if ( myAttribute->Bindable )
{
   // Insert code here.
}
// Gets the attributes for the property.
AttributeCollection attributes =
   TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;

// Checks to see if the property is bindable.
BindableAttribute myAttribute = (BindableAttribute)attributes[typeof(BindableAttribute)];
if (myAttribute.Bindable)
{
    // Insert code here.
}
  ' Gets the attributes for the property.
  Dim attributes As AttributeCollection = _
     TypeDescriptor.GetProperties(Me)("MyProperty").Attributes

       ' Checks to see if the property is bindable.
       Dim myAttribute As BindableAttribute = _
       CType(attributes(System.Type.GetType("BindableAttribute")), BindableAttribute)
       If (myAttribute.Bindable) Then
           ' Insert code here.
       End If

A következőre érvényes:

Lásd még