BindableAttribute.Bindable Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
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 :
PropertyDescriptorCollection Az objektum összes tulajdonságát tartalmazó lekérdezés.
Indexelés a PropertyDescriptorCollection lekéréshez
MyProperty.A tulajdonság attribútumainak mentése az attribútum változóban.
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:
// 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