BindableAttribute.Bindable Eigenschap

Definitie

Hiermee wordt een waarde opgehaald die aangeeft dat een eigenschap doorgaans wordt gebruikt voor binding.

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

Waarde van eigenschap

true als de eigenschap doorgaans wordt gebruikt voor binding; anders, false.

Voorbeelden

In het volgende codevoorbeeld wordt gecontroleerd of MyProperty bindbaar is. Eerst haalt de code de kenmerken op waarvoor MyProperty u het volgende doet:

Vervolgens wordt de code ingesteld myAttribute op de waarde van de BindableAttribute in de AttributeCollection code en wordt gecontroleerd of de eigenschap bindbaar is.

Als u dit codevoorbeeld wilt uitvoeren, moet u de volledig gekwalificeerde assemblynaam opgeven. Zie voor meer informatie over het verkrijgen van de volledig gekwalificeerde assemblynaam

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

Van toepassing op

Zie ook