Tuesday, April 30, 2013

N=5: Some first ICommands and multiple page (N+1 days of MvvmCross)

Back in action after some Xamarin Activation gremlins, I've recorded a new N+1 :)

This sample shows:
  • some fab new features which make the 3.0.5 nuget packages even easier to use
  • how to add ICommand's to ViewModel's
  • how to bind ICommand's to Buttons in WinRT, WP, Droid and Touch
  • how to add multiple view models
  • how to add multiple views in WinRT, WP, Droid and Touch
  • how to navigate between views/view models

The finished code is in: https://github.com/slodge/NPlus1DaysOfMvvmCross/tree/master/N-05-MultiPage

The video of the action is:

Wasn't quite up to my normal speed today - sorry, will type quicker but will talk slower again next time :)

Now we're up and running, if you have any other feedback or requests, please put them on comments here or on Xamarin forums.

If you have technical questions, then StackOverflow please :)

It's good to be back!

Previously in N+1:


  1. I’ve read through the N+1 video from Stuart and some other tutorials. But none of them seems to cover how to implement a infinite scroll list or push down to refresh list.

    I think they are quite common in mobile apps. Can anyone please shed some light on how to do this?

    Specific in how to implement it on Android and iOS with MVVMCross

    Thanks in advanced!

    1. I searched "https://www.bing.com/search?q=infinite+scroll+mvvmcross" - second hit was http://www.sequence.co.uk/blog/infinite-scrolling-using-mvvmcross-and-xamarin/

  2. Thank you for all your tuto it is very helpful.
    Please can you just explain how does a view model know to which view it is related or vice-versa?
    For exemple:
    In firsViewModel you did this:
    ShowViewModel < SecondViewModel>();
    How will SecondViewModel know that it has to display secondView/SecondePage?
    I didn't see any configuration doing this.

    Please can you also explain how does the new dependency injection work in v3. What I remarked is that you just ask for a parameter in a constructor and no where you fill in this constructor with value.
    Thanks a lot.

    1. this an example of what I want to do:

    2. There is two ways
      We need to follow naming conventions like
      if you created one viewModel with the name of FirstViewModel

      We need to write the name of view as FirstView
      If you don’t follow the naming conventions you need to tell to the view which ViewModel needs to instantiate by giving below Attribute the above the view class.(ie.xaml.cs)
      Attribute is: [MvvmCross.Core.ViewModels.MvxViewFor(typeof(SecondViewModel))]