BindableAttribute.Bindable Propriété

Définition

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 si MyProperty est lié. Tout d’abord, le code obtient les attributs pour MyProperty en procédant comme suit :

Ensuite, le code définit myAttribute sur la valeur de BindableAttribute dans et AttributeCollection vérifie si la propriété est lié.

Pour que cet exemple de code s’exécute, vous devez fournir le nom complet de l’assembly. Pour plus d’informations sur la façon d’obtenir le nom complet de l’assembly, consultez

Noms d’assemblys.

// 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

S’applique à

Voir aussi