BindableAttribute.Bindable Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
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:
Een met alle eigenschappen voor het object ophalen PropertyDescriptorCollection .
Indexeren in het PropertyDescriptorCollection bestand om op te halen
MyProperty.De kenmerken voor deze eigenschap opslaan in de kenmerkvariabele.
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
// 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