July 13, 2015 // By Brent Edwards
This is the fourth part in a 5 part series. We’ve looked at Xamarin.Forms and why you should use MvvmCross, how to create your Xamarin.Forms project (Part 1), how to include MvvmCross in your Xamarin.Forms project (Part 2), and how to get your app running on Android (Part 3). In this part, we’ll look at what it takes to get your app up and running on Windows Phone.
Open your solution from the first three parts and carry on.
In the WinPhone project:
- Add the following to the constructor in App.xaml.cs:
- Add the following to App.xaml.cs Application_Launching:
- Add the following to App.xaml.cs:
- Delete the ToDo-MvvmCross folder
- Add the Helpers/MvxFormsWindowsPhonePagePresenter class
- This class came from a comment in the Xamarin forums: http://forums.xamarin.com/discussion/comment/76871/#Comment_76871
- Update Setup to override CreateViewPresenter method and return the newly created presenter:
- In Main.xaml.cs, replace the previously commented out call to LoadApplication with:
That’s it! You should now have your app up and running on both Android and Windows Phone. We’re almost there! In the final part of the series, we’ll get your app up and running on iOS.
You’ve just read part 4 of the “Comprehensive Guide to Creating a Xamarin.Forms App with MvvmCross” blog series. To read part 5, click here. If you’d like to contact Magenic, email us or call us at 877-277-1044.