Episode 5: MVVM & Data Binding with Xamarin.Forms

Play Episode 5: MVVM & Data Binding with Xamarin.Forms
Sign in to queue

Description

 Out of all architectural patterns Model-View-ViewModel, or MVVM, has to be my favorite. MVVM enables developers to separate their business logic from their user interface code no matter if you are developing with iOS Storyboards, Android XML, or Xamarin.Forms XAML. In this episode I cover the basic building blocks of the MVVM pattern and then introduce you to the build in data binding framework built right into Xamarin.Forms so there is no need to ever manually set a text property, register for a click handler, and automatically enable and disable controls with Commands. 

Segments:

Show Links:

Useful Links:

Embed

Download

Right click to download this episode

The Discussion

  • User profile image
    manojkulkar​ni30

    Very helpful. Thank you James

  • User profile image
    PeterNL

    More of these types of code explanations and I will ask my manager to become a Xamarin app developer. Great stuff!

  • User profile image
    Xam

    @PeterNL - Agreed! Would love to see more shows where Xamarin.Forms is explored...

    @James - how about another spin-off... The Xamarin.Forms Show!

  • User profile image
    paulmccranie

    Great teaching - thanks, James!

  • User profile image
    SoylentGreen

    James,

    Are you going to release any code from all the Xamarin shows? I see you have code from the first episode on GitHub. Good job at VSLive Anaheim by the way.

    Del

  • User profile image
    exim

    This is really exciting!

    Btw, is there any chance you abandon Xamarin.iOS and Android GUI parts and concentrate all resources only for Forms? I mean, GUI-wise, cross-platform-ness of Xamarin (i.e. Forms) is all that really matters.

  • User profile image
    exim

    How about MVVM & Data binding for programmatically created UI? (without XAML)

  • User profile image
    exim

    One bad thing with these Xamarin videos though... Author is not very active in comments/followups. The videos are just posted and forgotten it seems.

  • User profile image
    James​Montemagno

    @Xam: I think you will see a great blend of topics covering all aspects of Xamarin and Xamarin.Forms :) I also use a lot of tags that you can now filter on :)

     

    @exim: I check comments weekly and respond actively, happened to be at conferences the last 2 weeks and on a plane to Taipei for the last 16 hours. For databinding in C# essentially each control has a "SetBinding" that can be used. Many of the sample have both XAML and C#, however most developer prefer XAML as it is very easy to read through. https://developer.xamarin.com/api/member/Xamarin.Forms.BindableObjectExtensions.SetBinding/p/Xamarin.Forms.BindableObject/Xamarin.Forms.BindableProperty/System.String/

    Xamarin.iOS and Xamarin.Android are the backbone to Xamarin.Forms, without them it wouldnt' be possible to have Xamarin.Forms when you think of how the abstraction is created. Additionally, traditional Xamarin will give you the pure access to every since control, full storyboard support/android xml, and so much more that developers love when they want to get right to the metal of each platform. 

    @SoylentGreen: I am working on each episode, sometimes there just isn't a lot of "code" to share, but I have just updated the repo and will be adding them in the show notes as well.

     

  • User profile image
    PaulDrumm

    Great tutorial, any ETA on getting the sample app uploaded?

    Thanks

     

  • User profile image
    James​Montemagno
  • User profile image
    exim

    Thanks!

    Btw, any good resources (tutorials, lecture videos, books) about complete app development (i.e. non-UI parts such as database, networking, etc..) using Xamarin.Forms?

    There are many Forms tutorials but usually they discuss only UI part, do not talk about back-end/DB parts.

  • User profile image
    James​Montemagno
  • User profile image
    Adeel Ehsan

    Yet another great video James. I have been requesting an in depth video on XamForms+Azure+PushNotifications. I said vie twitter that I wont stop until you do it :). Good news I have been able to tackle all pitfalls and some tricky undocumented areas and have come up with full implementation of Push Notifications using Xam Forms and Azure Notifications Hubs. This involved my own back end web api for device registration and unregistration etc and my own back end to send the notifications. Not to forget receive and handle the Push Notifications in both Android and iOS platforms coz its tricky.

    BUT, it will be great watching YOU explaining everything. So staying tuned.....

  • User profile image
    Robert Auer

    This is well done - but in the latest update to Visual Studio 2017 (15.6.4), they have removed the portal class libraries. Is there any place that covers that change in the system?

  • User profile image
    Leonan Fraga Leonardo

    James please, HIRE ME!!!
    Let me learn with you!!!:D:D
    You are an amazing developer.
    I have been searching for a long time how to use MVVM and have always been confused. With this video I learned much easier and faster. Thank you!

  • User profile image
    Prashant Pimpale

    Hi,

    I am using MVVM in my project but facing difficulties while binding the data on view

  • User profile image
    erdnay
    Great video!

    MVVM appears to behave in Xamarin.Forms much like Windows WPF.

    I noticed that creates a DataContext with C# code in the MainPage constructor. Would the following work technique work as well, creating DataContext in the XAML code?

    (in the namespace declaration near the top)

    xmlns:vm="clr-namespace:ViewModels"

    (first item in the XAML tree)

    MainPage.DataContext> vm:AddContactViewModel />/MainPage.DataContext>
    Thanks

Add Your 2 Cents