According to the Windows 10 SDK kick start videos (http://www.microsoftvirtualacademy.com/training-courses/a-developers-guide-to-windows-10-preview?prid=ch9courselink) there is a new type of bindings for the Windows 10 universal app platform called "compiled data bindings".
Instead of
"{Binding Path=..."
the new style is
"{x:Bind Path=..."
However this only throws in a compiler error that whatever is behind the = is placed does not exist in the context.
Setting
"{x:Bind Path=DataContext...."
does not work either.
Has anybody managed to get the new bindings to work? Is there ANY documentation on the topic because I don't seem to be able to find anything (not even a sample that you could "reverse engeneer"...
Update:
Thanks to Nick's response I can add the following:
Since I usually insert view models after the Page / UserControl is initialized, the Page / UserControl does not seem to notice the updated ViewModel property (even when the Page / UserControl implements and "fires" INotifyPropertyChanged).
Apparently there is a new field in Pages / UserControls called Bindings which can enforce a reset of all compiled data bindings.
So once you change your ViewModel (or another property referenced by x:Bind) you can simply call:
Binding.UpdateAll()
This way the Page / UserControl reevaluates all compiled data bindings and accepts a "data context switch".
Hope this helps - http://nicksnettravels.builttoroam.com/post/2015/04/26/Compiled-DataBinding-in-Windows-Universal-Applications-(UAP).aspx This explains what the context is and how some of the compiled bindings are generated
I'll just add these two links to official documentation since it is available now and the content seems relevant to the subject.
1) {x:Bind} markup extension
2) {x:Bind} and {Binding} feature comparison
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With