O'Reilly logo

Mastering Windows 8 C++ App Development by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Object-to-element binding

Although an element-to-element binding is sometimes useful, the classic data binding scenario involves a source, which is a regular, non-UI object, and a target, which is a UI element. The binding expression itself is similar to the element-to-element binding case; but naturally the ElementName property cannot be used.

The first step is to create an object that can support data binding. This must be a WinRT class that's decorated with the Bindable attribute. The bindings themselves are on properties (as always). Here's a simple Person class declaration:

[Windows::UI::Xaml::Data::BindableAttribute] public ref class Person sealed { public: property Platform::String^ FirstName; property Platform::String^ LastName; property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required