BindableAttribute.Bindable Eigenschaft

Definition

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

public:
 property bool Bindable { bool get(); };
public bool Bindable { get; }
member this.Bindable : bool
Public ReadOnly Property Bindable As Boolean

Eigenschaftswert

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

Beispiele

Im folgenden Codebeispiel wird überprüft, ob MyProperty gebunden werden kann. Zunächst ruft der Code die Attribute für MyProperty ab, indem er die folgenden Schritte ausführt:

Anschließend wird der Code auf den Wert von BindableAttribute in AttributeCollection festgelegtmyAttribute, und überprüft, ob die Eigenschaft gebunden werden kann.

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

Assemblynamen.

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

Gilt für:

Weitere Informationen