BindableAttribute.Bindable Propiedad

Definición

Obtiene un valor que indica que una propiedad se utiliza normalmente para el enlace.

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

Valor de propiedad

true si la propiedad se utiliza normalmente para el enlace; en caso contrario, false.

Ejemplos

En el ejemplo de código siguiente se comprueba si MyProperty se puede enlazar. En primer lugar, el código obtiene los atributos de MyProperty haciendo lo siguiente:

A continuación, el código establece myAttribute en el valor de BindableAttribute en AttributeCollection y comprueba si la propiedad se puede enlazar.

Para que se ejecute este ejemplo de código, debe proporcionar el nombre completo del ensamblado. Para obtener información sobre cómo obtener el nombre completo del ensamblado, consulte

Nombres de ensamblado.

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

Se aplica a

Consulte también