Book Image

Xamarin.Forms Projects

By : Johan Karlsson, Daniel Hindrikes
Book Image

Xamarin.Forms Projects

By: Johan Karlsson, Daniel Hindrikes

Overview of this book

Xamarin.Forms is a lightweight cross-platform development toolkit for building applications with a rich user interface. In this book you'll start by building projects that explain the Xamarin.Forms ecosystem to get up and running with building cross-platform applications. We'll increase in difficulty throughout the projects, making you learn the nitty-gritty of Xamarin.Forms offerings. You'll gain insights into the architecture, how to arrange your app's design, where to begin developing, what pitfalls exist, and how to avoid them. The book contains seven real-world projects, to get you hands-on with building rich UIs and providing a truly cross-platform experience. It will also guide you on how to set up a machine for Xamarin app development. You'll build a simple to-do application that gets you going, then dive deep into building advanced apps such as messaging platform, games, and machine learning, to build a UI for an augmented reality project. By the end of the book, you'll be confident in building cross-platforms and fitting Xamarin.Forms toolkits in your app development. You'll be able to take the practice you get from this book to build applications that comply with your requirements.
Table of Contents (11 chapters)

To get the most out of this book

We recommend that you read the first chapter to make sure that you are up to speed with the basic concepts of Xamarin in general. After that, you could pretty much pick any chapter you like to learn more about. Each chapter is standalone but the chapters are ordered by complexity; the further you are into the book, the more complex the app is.

The apps are adapted for real-world use but some parts are left out, such as proper error handling and analytics, since they are out of the scope of the book. You should, however, get a good grasp of the building blocks of how to create an app.

Having said that, it does help if you have been a C# and .NET developer for a while, since many of the concepts are not really app-specific but are good practice in general, such as Model-View-ViewModel and Inversion of Control.

But, most of all, it's a book you can use to kick-start your Xamarin.Forms development learning curve by focusing on what chapters interest you the most.

Download the example code files

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Open the DescriptionGenerator.cs file and add a constructor, as shown in the following code."

A block of code is set as follows:

public class DescriptionGenerator
{
private string[] _adjectives = { "nice", "horrible", "great",
"terribly old", "brand new" };
private string[] _other = { "picture of grandpa", "car", "photo
of a forest", "duck" };
private static Random random = new Random();
public string Generate()
{
var a = _adjectives[random.Next(_adjectives.Count())];
var b = _other[random.Next(_other.Count())];
return $"A {a} {b}";
}
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

base.OnCreate(savedInstanceState);

global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
LoadApplication(new App());
}

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info from the Administration panel."

Warnings or important notes appear like this.
Tips and tricks appear like this.