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 s’il MyProperty est lié. Tout d’abord, le code obtient les attributs pour MyProperty tableaux suivants :

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

Noms d’assembly.

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