Creating Mobile Apps with Xamarin.Forms, Preview Edition (Developer Reference) by Petzold Charles
Author:Petzold, Charles [Petzold, Charles]
Language: eng
Format: epub, mobi
Publisher: Pearson Education
Published: 2014-09-25T21:00:00+00:00
editor.BindingContext = note;
editor.SetBinding(Editor.TextProperty, "Text");
Internally, these four statements result in similar event handlers being set. That’s how the data-binding mechanism works.
However, these four statements can actually be reduced to three statements. Here’s how:
The BindingContext property has a very special characteristic. It is very likely that more than one data binding on a page has the same BindingContext. That is true for this little example. For this reason, the BindingContext property is propagated through the visual tree of a page. In other words, if you set the BindingContext on a page, it will propagate to all the views on that page except for those views that have their own BindingContext properties set to something else. You can set BindingContext on a StackLayout and it will propagate to all the children (and other descendants) of that StackLayout. The two BindingContext settings shown above can be replaced with one set on the page itself:
this.BindingContext = note;
These automated data bindings are part of the NoteTaker5Page class. Also, the handlers for the Load and Save buttons have become lambda functions, all the variables have been moved to the constructor, and the code is looking quite sleek at this point:
Click here to view code image
class NoteTaker5Page : ContentPage
{
static readonly string FILENAME = "test.note";
Download
Creating Mobile Apps with Xamarin.Forms, Preview Edition (Developer Reference) by Petzold Charles.mobi
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6554)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6445)
Kotlin in Action by Dmitry Jemerov(5092)
Odoo 15 Development Essentials - Fifth Edition by Daniel Reis & Greg Mader(3509)
Odoo 15 Development Essentials by Daniel Reis(2836)
React Native - Building Mobile Apps with JavaScript by Novick Vladimir(2551)
Learning Angular - Second Edition by Christoffer Noring(2381)
Pride and Prejudice by Jane Austen(2370)
Mobile Forensics Cookbook by Igor Mikhaylov(2039)
Computers For Seniors For Dummies by Nancy C. Muir(2023)
Bulletproof Android: Practical Advice for Building Secure Apps (Developer's Library) by Godfrey Nolan(1893)
Android Development with Kotlin by Marcin Moskala & Igor Wojda(1817)
Building Android UIs with Custom Views by Raimon Ràfols Montané(1810)
1936941139 (N) by Bob Rosenthal(1756)
Building Progressive Web Apps: Bringing the Power of Native to the Browser by Ater Tal(1748)
Hands-On Internet of Things with MQTT by Tim Pulver(1731)
Android App Development by Franceschi Hervé J.;(1729)
Ember.js in Action by Joachim Haagen Skeie(1711)
Hands-On Design Patterns with React Native by Mateusz Grzesiukiewicz(1670)
