Using data binding and MVVM
At this point, you should be grasping the basics of Xamarin.Forms, but you may be wondering how the MVVM design pattern fits into the picture. The MVVM design pattern was originally conceived for its use along with XAML and the powerful data binding features XAML provides, so it is only natural that it is a perfect design pattern to be used with Xamarin.Forms.
Let's cover the basics of how data binding and MVVM is set up with Xamarin.Forms:
- Your Model and ViewModel layers will remain mostly unchanged from the MVVM pattern we covered earlier in the module.
- Your ViewModel layer should implement the
INotifyPropertyChanged
interface, which facilitates data binding. To simplify things in Xamarin.Forms, you can use theBindableObject ...
Get Xamarin: Cross-Platform Mobile Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.