Jaa


BindableAttribute Class

Definition

Specifies that a type defined in C++ can be used for binding.

public ref class BindableAttribute sealed : Attribute
/// [Windows.Foundation.Metadata.AttributeUsage(System.AttributeTargets.RuntimeClass)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class BindableAttribute final : Attribute
/// [Windows.Foundation.Metadata.AttributeUsage(System.AttributeTargets.RuntimeClass)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.AttributeName("bindable")]
class BindableAttribute final : Attribute
[Windows.Foundation.Metadata.AttributeUsage(System.AttributeTargets.RuntimeClass)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class BindableAttribute : Attribute
[Windows.Foundation.Metadata.AttributeUsage(System.AttributeTargets.RuntimeClass)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.AttributeName("bindable")]
public sealed class BindableAttribute : Attribute
Public NotInheritable Class BindableAttribute
Inherits Attribute
Inheritance
BindableAttribute
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following code example shows the typical usage pattern for this attribute. For the complete code listing, see the XAML data binding sample.

If you're using C++/WinRT, then you need to add the BindableAttribute only if you're using the {Binding} markup extension. If you're using the {x:Bind} markup extension, then you don't need BindableAttribute (for more info, see XAML controls; bind to a C++/WinRT property).

// MyColors.idl
namespace MyColorsApp
{
    [bindable]
    [default_interface]
    runtimeclass MyColors : Windows.UI.Xaml.Data.INotifyPropertyChanged
    {
        MyColors();
        Windows.UI.Xaml.Media.SolidColorBrush Brush1;
    }
}
[Windows::UI::Xaml::Data::Bindable]
public ref class Employee sealed : Windows::UI::Xaml::Data::INotifyPropertyChanged
{
    // ...
}

Remarks

Apply this attribute to C++-based data classes to enable their use as binding sources. Common language runtime (CLR) types, including all types defined in C# and Microsoft Visual Basic, are bindable by default. You can also make a type bindable by implementing ICustomPropertyProvider. For more info, see Data binding in depth.

Constructors

BindableAttribute()

Initializes a new instance of the BindableAttribute class.

Applies to

See also