BindableAttribute Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
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
{
// ...
}
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.
Bindable |
Initializes a new instance of the BindableAttribute class. |
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |