Book Image

Xamarin Essentials

By : Mark Reynolds
Book Image

Xamarin Essentials

By: Mark Reynolds

Overview of this book

<p>Xamarin is a Mono-based suite of products that allows developers to create iOS and Android apps using C# and .NET.</p> <p>This learning guide is your first port of call to quickly learn Xamarin. Starting with the foundations by understanding the architecture behind Xamarin.iOS and Xamarin.Android, you will be guided through creating your first Xamarin.iOS and Xamarin.Android applications. In addition, you will learn how to utilize frameworks such as MvvmCross and Xamarin.Forms to increase the amount of code reuse. To conclude your journey, you will be shown how to develop your own Xamarin apps for distribution.</p> <p>Xamarin Essentials is the guide to use in order to quickly gain practical working knowledge of developing robust commercial mobile apps using C# and sharing large portions of your code base across iOS and Android apps.</p>
Table of Contents (17 chapters)
Xamarin Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the NationalParks Xamarin.Forms app


Now that we have a solid understanding of Xamarin.Forms, let's convert our NationalParks app to use the new framework. For this exercise, we will follow the same app flow that we have used in the iOS app so far, meaning that we will have a list page, a detail page to view, and an edit page to add and update.

Creating the solution

We will start by creating an entirely new project by performing the following steps:

  1. To start with, access the File menu and navigate to New | New Solution.

  2. In the New Solution dialog box, navigate to C# | Mobile Apps, select the Blank App (Xamarin.Forms Portable) template, enter NationalParks in the Name field, choose the appropriate Location value, and click on OK.

  3. Review the project structure. You will see the following pointers:

    • Open AppDelegate.cs in the NationalParks.iOS project. Note the calls to Forms.Init() and App.GetMainPage().

    • Open MainActivity.cs in the NationalParks.Android project. Note the calls to Forms.Init...