BindableAttribute.Bindable Eigenschaft

Definition

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

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

Eigenschaftswert

truewenn die Eigenschaft in der Regel für die Bindung verwendet wird; andernfalls . false

Beispiele

Im folgenden Codebeispiel wird überprüft, ob MyProperty eine Bindung erforderlich ist. Zuerst ruft der Code die Attribute für MyProperty folgendes ab:

Anschließend wird der Code auf den Wert des Ins BindableAttributeAttributeCollection festgelegt myAttribute 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