BindableAttribute.Bindable Właściwość

Definicja

Pobiera wartość wskazującą, że właściwość jest zwykle używana do powiązania.

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

Wartość właściwości

Boolean

true jeśli właściwość jest zwykle używana do powiązania; w przeciwnym razie , false.

Przykłady

Poniższy przykład kodu sprawdza, czy MyProperty można powiązać. Najpierw kod pobiera atrybuty, MyProperty wykonując następujące czynności:

Następnie kod ustawia myAttribute wartość BindableAttribute elementu w obiekcie AttributeCollection i sprawdza, czy właściwość jest powiązana.

Aby ten przykładowy kod zadziałał, należy podać w pełni kwalifikowaną nazwę zestawu. Aby uzyskać informacje o sposobie uzyskania w pełni kwalifikowanej nazwy zestawu, zobacz

Nazwy zestawów.

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

Dotyczy

Zobacz też