Getting Started with Xamarin.Forms – The Fundamentals

Every so often, I get the pleasure of introducing a fellow developer to Xamarin.Forms for a new project. As with any new technology, it can be hard to know where to start. Over the years, I’ve aggregated a mass of bookmarks and knowledge that I wish I knew on my first day using Forms, that I eventually got around to putting to paper. I hope you can pass it the nuggets on when you, too, introduce someone to the wonderful world of cross-platform development or perhaps even use as a new Xamarin Developer yourself!

Recommended Xamarin University Courses

Here’s a link to all Xamarin.Forms topics on Xam U. You can use either a free trial or an existing MSDN account to access the following Xamarin University Courses, most of which are available on demand. At a minimum, I recommend checking out these courses, even if you don’t pursue either certification track:

  • XAM120 – Introduction to Xamarin.Forms
  • XAM130 – XAML in Xamarin.Forms
  • XAM135 – Layout in Xamarin.Forms
  • XAM270 – Data Binding in Xamarin.Forms
  • XAM320 – Designing an MVVM ViewModel in Xamarin.Forms

MVVM & Architectural Patterns in Mobile

MVVM is pretty solid approach to most mobile projects. Totally new to MVVM? Check out this course on Pluralsight. My favorite MVVM framework for most people/projects is Prism. Here’s an intro video from the guy who made it. I did a short write-up on using Prism in Xamarin.Forms, which includes links to a GitHub repo if you want a starter project.

Components Quick Reference

Not sure what to use/where? I refer to this handy guide early and often when looking for what existing UI components I can leverage. The brave can see the full and complete list here

A Note on Platform Specific Functionality

Eventually, you will find yourself needing functionality that is specific to a platform, be it presenting the dialer, opening the native maps application, getting the GPS location of the device, or any number of things that simply cannot be handled in shared code. Before you implement anything, check out the list of plugins, accessible via NuGet, to see if somebody has already done the work for you

A Note on Platform Specific Appearances

Eventually, you will find yourself wanting to make a control or view look a certain way using properties that just aren’t available in the shared Forms space. Fear not! Creating Effects in each of your platform-specific projects. I’ve done a few write-ups on the usefulness of effects if you’re interested in real-word scenarios, which allow you full, unbridled access to the entirety of each platform’s API, as if you were developing in Xamarin.Android or Xamarin.iOS.

Android Emulators

For windows machines and macs, I recommend using the Google Emulators and adding HAXM to improve performance. Using Hyper-V on Windows? No problem – If you’re running the April 2018 update or newer, you can now use Hyper-V with the standard emulators. If all else fails the legacy Android Emulator for Visual Studio (which requires Hyper-V) can be a flawed, but functional fallback.

Generally speaking, I’d recommend adding API 23 to 27 at least. Download device images sparingly, as they can be a storage hog

iOS Remote Simulator (VS Windows Only)

You can also run an iOS simulator from your windows machine to test and debug iPhone builds. Find the full guide and setup and configuration here

N.B – you will need VS Enterprise to use the remoted simulator AND be connected to the same network as your mac to access the remote sim.

Xamarin Live Player

If you don’t have a mac handy or just want to get started with iOS development on your personal device, check out this blog post on setting up Xamarin Live Player. This feature is still a little immature at this stage, so your mileage may vary

Build Automation

Once you’re ready for the big leagues, check out Microsoft App Center or set up a hosted mac agent in your VSTS project to get started with CI/CD

What are some fundamentals you wish you knew when you first started developing in Xamarin? I’d love to hear about your experience in the comments!

One thought on “Getting Started with Xamarin.Forms – The Fundamentals

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s