BindableAttribute.Bindable Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает значение, указывающее, что свойство обычно используется для привязки.
public:
property bool Bindable { bool get(); };
public bool Bindable { get; }
member this.Bindable : bool
Public ReadOnly Property Bindable As Boolean
Значение свойства
true Значение , если свойство обычно используется для привязки; falseв противном случае .
Примеры
В следующем примере кода проверяется, является ли MyProperty привязка привязываемой. Сначала код получает атрибуты для MyProperty следующих действий:
PropertyDescriptorCollection Получение объекта со всеми свойствами.
Индексирование в PropertyDescriptorCollection получение
MyProperty.Сохранение атрибутов для этого свойства в переменной атрибутов.
Затем код задает myAttribute значение BindableAttribute в элементе AttributeCollection и проверяет, является ли свойство привязываемым.
Для выполнения этого примера кода необходимо указать полное имя сборки. Сведения о том, как получить полное имя сборки, см. в разделе
// 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