Share via


BindableAttribute Constructor (Boolean)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Initializes a new instance of the BindableAttribute class with a Boolean value.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

Syntax

'Declaration
Public Sub New ( _
    bindable As Boolean _
)
public BindableAttribute(
    bool bindable
)

Parameters

  • bindable
    Type: System.Boolean
    true to use property for binding; otherwise, false.

Remarks

When you mark a property with the BindableAttribute set to true, the value of this attribute is set to the constant member Yes. For a property marked with the BindableAttribute set to false, the value is No. Therefore, to check the value of this attribute in your code, you must specify the attribute as BindableAttribute.Yes or BindableAttribute.No.

Examples

The following code example marks a property as appropriate to bind data to. This code example creates a new BindableAttribute, sets its value to BindableAttribute.Yes, and binds it to the property.

<Bindable(True)> _
Public Property MyProperty() As Integer
    Get
        ' Insert code here.
        Return 0
    End Get
    Set(ByVal value As Integer)
        ' Insert code here.
    End Set
End Property

Private Sub button1_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

End Sub
[Bindable(true)]
public int MyProperty
{
    get
    {
        // Insert code here.
        return 0;
    }
    set
    {
        // Insert code here.
    }
}

private void button1_Click(object sender, RoutedEventArgs e)
{

}

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.