FreshMvvm Quick Start Guide

FreshMvvm is designed to be easy and simple. So getting started is also fairly simple.

Step 1. Start new project

Start a new Xamarin.Forms Project using Portable Class Libraries.

Step 2. Obtain FreshMvvm from Nuget

Obtain FreshMvvm from Nuget by searching for FreshMvvm, make sure to do this on your Xamarin.Forms PCL project.

Step 3. Create QuoteList Page

Once you’ve got the packages you can then create your first Page and PageModel. In the Xamarin.Forms PCL project, let’s create a QuoteListPage.xaml and corresponding QuoteListPageModel.cs.



Step 4. Create Quote Page

We will also need a page which shows the details of a quote. So we can create a QuotePage.xaml and a corresponding QuotePageModel.cs.



 Step 5. Setup Navigation

You have the options of using a built-in navigation or implement your own.

With the built in navigation items you have the options of:

  1. FreshNavigationContainer – Which is a basic navigation with push and pop

  2. FreshMasterDetailNavigationContainer – Use for a master detail style app

  3. FreshTabbedNavigationContainer – User for a tabbed style app

  4. For some thing more complex you can implement IFreshNavigationService

In this sample we can use a tabbed style app. In your Xamarin.Forms PCL open your App.cs and in the constructor add the following code.

And that’s it, we now have made the first steps to implementing FreshMvvm. If you wanted a different Navigation style then you could use one of the other types of built in Navigation or even implement your own.

The great sample project similar to this can be found in the sample directory on the project.


3 Responses

  1. Just some minor feedback.

    I was confused with the BasePage. I thought for whateve reason this would be in the FreshMvvm namespace…now that I think about it that is just silly of me.

    Second, at the end you have this:
    tabbedNavigation.AddTab (“Contacts”, null);

    But I believe you should be passing in the QuoteListPageModel.


  2. Michael, working with FreshMvvm I am having difficulty getting the ReverseInit method to work. It appears that the private field PageModelCoreMethods._pageModel is never set and is required for ReverseInit to fire. Is _pageModel set somewhere using reflection which I have not found? Or is this a bug?

    I’m very much enjoy your Mvvm implementation. Thanks,


  3. Hi Michael,

    Great post, and your framework looks really easy to use.

    In the GitHub README you give your reasons for rolling your own framework rather than using MvvmCross. I can understand your reasons, though one of useful features it provides is the Plugin framework – it would be great to see a future post that shows a cross platform plugin which uses your IoC container for the platform specific implementation.

    Also, did you take a look at MvvmLight? Perhaps that wasn’t ready for XF when you started looking for a framework?

    Thanks , Jason

Leave a Reply