BindableAttribute.Bindable Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient une valeur indiquant qu’une propriété est généralement utilisée pour la liaison.
public:
property bool Bindable { bool get(); };
public bool Bindable { get; }
member this.Bindable : bool
Public ReadOnly Property Bindable As Boolean
Valeur de propriété
true si la propriété est généralement utilisée pour la liaison ; sinon, false.
Exemples
L’exemple de code suivant vérifie s’il MyProperty est lié. Tout d’abord, le code obtient les attributs pour MyProperty tableaux suivants :
Récupération d’une PropertyDescriptorCollection propriété avec toutes les propriétés de l’objet.
Indexation dans l’index PropertyDescriptorCollection pour obtenir
MyProperty.Enregistrement des attributs pour cette propriété dans la variable d’attributs.
Ensuite, le code définit myAttribute la valeur de l’élément BindableAttribute dans le AttributeCollection code et vérifie si la propriété est liée.
Pour que cet exemple de code s’exécute, vous devez fournir le nom complet de l’assembly. Pour plus d’informations sur l’obtention du nom complet de l’assembly, consultez
// 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