Freigeben über


BindableAttribute.Bindable-Eigenschaft

Ruft einen Wert ab, der angibt, dass eine Eigenschaft normalerweise für Bindungen verwendet wird.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

Syntax

'Declaration
Public ReadOnly Property Bindable As Boolean
'Usage
Dim instance As BindableAttribute
Dim value As Boolean

value = instance.Bindable
public bool Bindable { get; }
public:
property bool Bindable {
    bool get ();
}
/** @property */
public boolean get_Bindable ()
public function get Bindable () : boolean

Eigenschaftenwert

true, wenn die Eigenschaft normalerweise für Bindungen verwendet wird, andernfalls false.

Beispiel

Im folgenden Codebeispiel wird überprüft, ob MyProperty gebunden werden kann. Zunächst werden im Code die Attribute für MyProperty wie folgt abgerufen:

  • Abrufen einer PropertyDescriptorCollection mit allen Eigenschaften für das Objekt.

  • Abrufen von MyProperty über den Index in PropertyDescriptorCollection.

  • Speichern der Attribute für diese Eigenschaft in der attributes-Variablen.

Anschließend wird im Code myAttribute auf den Wert des BindableAttribute in der AttributeCollection festgelegt, und es wird überprüft, ob die Eigenschaft gebunden werden kann.

Damit dieses Codebeispiel ausgeführt werden kann, müssen Sie den vollqualifizierten Assemblynamen bereitstellen. Informationen über das Abrufen des vollqualifizierten Assemblynamens finden Sie unter

Assemblynamen.

' 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
// 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.
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).get_Item("MyProperty").
    get_Attributes();

// Checks to see if the property is bindable.
// You must supply a valid fully qualified assembly name here. 
BindableAttribute myAttribute =
    (BindableAttribute)(attributes.get_Item(Type.GetType
    ("Assembly text name, Version, Culture, PublicKeyToken")));
if (myAttribute.get_Bindable()) {
    // Insert code here.
}

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

BindableAttribute-Klasse
BindableAttribute-Member
System.ComponentModel-Namespace
BindableAttribute-Klasse
Attribute
PropertyDescriptor
AttributeCollection-Klasse
PropertyDescriptorCollection