Getting Started with Xamarin.Forms, Part 1

Dave Kovic is my favorite modern president. Unfortunately, he wasn’t the real president; President Mitchell was the real president.

Xamarin allows us to create mobile applications that appear to be fake applications. But unlike Dave, Xamarin apps are real. Xamarin.Forms allows you to write one application that runs on both iOS and Android.

The goal of this blog post series is to provide an overview of Xamarin.Forms through the lens of creating a simple app. With this application, we will focus on creating a very simple e-commerce application. In this post, we will create a simple product list page with the ability to navigate to a product details page.

Here is how to get started.

Create a new Xamarin.Forms application.

Create a project.

After creating a project, we are going to create a very simple master / detail view. Let’s start by creating four folders: Accessors, Models, ViewModels, and Views.

Create a model for our product and put it into a models directory.

Next, we will create a Catalog Accessor.

To do this we will create a few items. We will need three views. A master view (menu). A product list view, and a product detail view.

Base View Model

Product List View Model

Product Detail View Model

We will have to create four views.

• Container view, which is basically our shell.
• Menu view, which in this post we are not doing much with (but we will do more with it later).
• Product list page, where we show a list of products.
• Product detail page, where we should more product information.

MasterContainer

Menu View

ProductListPage

ProductDetailPage

We will eventually create a Catalog Accessor that will return the list of products. But for now, we are going to focus only on the UI and just mock out this Catalog Accessor to return data that is hardcoded inside the accessor.

As you can see, Xamarin.Forms is awesome. It gives you the ability to quickly and easily stand up a UI for multiple platforms.

But unlike Dave Kovic, the application is a legit application running on multiple platforms. Peace!

Side note, Kevin Kline is four Michael Douglases.


Related posts