BindableAttribute.Bindable Vlastnost

Definice

Získá hodnotu označující, že vlastnost se obvykle používá pro vazbu.

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

Hodnota vlastnosti

truepokud se vlastnost obvykle používá pro vazbu; v opačném případě . false

Příklady

Následující příklad kódu zkontroluje, zda MyProperty je vázatelný. Nejprve kód získá atributy pro MyProperty následujícím způsobem:

Pak kód nastaví myAttribute hodnotu BindableAttribute v AttributeCollection a zkontroluje, zda je vlastnost vázána.

Pro spuštění této ukázky kódu je nutné zadat plně kvalifikovaný název. Informace o tom, jak získat plně kvalifikovaný název sestavení, najdete v tématu

Názvy sestavení.

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

Platí pro

Viz také