BindableAttribute Class


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

public ref class BindableAttribute sealed : Attribute
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
public sealed class BindableAttribute : Attribute
Public NotInheritable Class BindableAttribute
Inherits Attribute
Windows.Foundation.Metadata.AttributeUsageAttribute Windows.Foundation.Metadata.ContractVersionAttribute Windows.Foundation.Metadata.WebHostHiddenAttribute


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
    runtimeclass MyColors : Windows.UI.Xaml.Data.INotifyPropertyChanged
        Windows.UI.Xaml.Media.SolidColorBrush Brush1;
public ref class Employee sealed : Windows::UI::Xaml::Data::INotifyPropertyChanged
    // ...


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.



Initializes a new instance of the BindableAttribute class.

Applies to

See also