BindableAttribute.Bindable Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém um valor que indica que uma propriedade é normalmente usada para ligação.
public:
property bool Bindable { bool get(); };
public bool Bindable { get; }
member this.Bindable : bool
Public ReadOnly Property Bindable As Boolean
Valor de Propriedade
true se a propriedade for tipicamente usada para ligação; caso contrário, false.
Exemplos
O exemplo de código seguinte verifica se MyProperty é vinculável. Primeiro, o código obtém os atributos para MyProperty fazendo o seguinte:
Recuperar um PropertyDescriptorCollection com todas as propriedades do objeto.
Indexando em para PropertyDescriptorCollection obter
MyProperty.Guardar os atributos desta propriedade na variável de atributos.
Depois, o código define myAttribute para o valor de BindableAttribute em e AttributeCollection verifica se a propriedade é vinculável.
Para que este exemplo de código seja executado, deve fornecer o nome de assembleia totalmente qualificado. Para informações sobre como obter o nome de assembleia totalmente qualificado, veja
// 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