Xamarin.Forms Projects
Second Edition
Build multiplatform mobile apps and a game from scratch using C# and Visual Studio 2019
Daniel Hindrikes
Johan Karlsson
BIRMINGHAM - MUMBAI
Xamarin.Forms Projects
Second Edition
Copyright 2020 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Pavan Ramchandani
Acquisition Editor: Heramb Bhavsar
Content Development Editor: Keagan Carneiro
Senior Editor: Sofi Rogers
Technical Editor: Shubham Sharma
Copy Editor: Safis Editing
Project Coordinator: Kinjal Bari
Proofreader: Safis Editing
Indexer: Manju Arasan
Production Designer: Jyoti Chauhan
First published: December 2018
Second edition: June 2020
Production reference: 1180620
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-83921-005-1
www.packt.com
I dedicate this book to all the people I met during my years as a Xamarin developer that never believed in Xamarin. If you read this book, you will hopefully understand how great Xamarin is!
Daniel Hindrikes
This book is dedicated to the spider in my basement that motivated me to write a book thick enough to finally kill him with.
Johan Karlsson
Packt.com
Subscribe to our online digital library for full access to over 7,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Fully searchable for easy access to vital information
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Foreword
Sometimes I scratch my head and wonder why Xamarin.Forms continues to rise in developer satisfaction ratings, winning more fans than ever before in its 6-year history. A developer recently said to me, "It's like you listened to our complaints and requests, and just fixed them." While that's an over-simplified summary, I get what they meant. Our program managers and engineers constantly feed their curiosity to figure out how we can delight those using our software. This has led to a faster build and deploy loop, Hot Reload for instant XAML changes in your running app, and Hot Restart for developing on your iOS device directly from Visual Studio on Windows.
Today, Xamarin.Forms ships with more controls "in the box" than ever before, largely thanks to an ever-expanding community of faithful contributors. And what about tomorrow? As I write this, we have just finished Microsoft Build 2020, where we announced our long-term plans for Xamarin.Forms and .NET 6, taking our roadmap all the way into 2022. What a great time to be a Xamarin.Forms and .NET developer! Your investment in .NET for building multi-platform apps will continue to pay off for years to come.
In my role at Microsoft on the .NET team, I'm frequently asked by developers where to find guidance to build Xamarin apps just like those presented in this book. I completely understand why! I love to learn by doing, playing, fiddling, and hopefully not banging my head too hard on the keyboard. Daniel and Johan bring many years of experience to this formula, to lead us down the path of success. I recommend this book to you, whether you are new to Xamarin.Forms or a grizzled .NET veteran. You'll find some lessons that are worth your while.
David Ortinau
Principal Program Manager, .NET
Microsoft
Contributors
About the authors
Daniel Hindrikes is a developer and architect with a passion for developing mobile apps powered by the cloud. Daniel fell in love with Xamarin in the early days of Xamarin when he realized that he could use C# even for iOS and Android apps, and that he could share code with the Windows apps he was also building. But Daniel started to build mobile apps long before that, working on Android apps with Java and even Java ME apps (a long, long time ago).
Daniel enjoys sharing his knowledge and can be found speaking at conferences, blogging, or recording the podcast, The Code Behind. Daniel works at the company tretton37 in Sweden and has experience working with both local and global customers .
I want to say a special thanks to my family, my wife, Anna-Karin, and our twins, Ella and Willner, all of whom have supported me during the writing process.
I also would like to say thanks to the fantastic team at Packt and our technical reviewers, Jimmy and Geoff, who helped us to write this book and make us look better than we really are.
Johan Karlsson has been working with Xamarin since the days of MonoTouch and Mono for Android, and it all started with writing a game. He is a full-stack developer, currently focusing on mobile applications using Xamarin, but has in the past worked a lot with ASP.NET MVC, Visual Basic.NET (not proud), and C# in general. Also, he's created a whole bunch of databases in SQL Server over the years.
Johan works at tretton37 in Sweden and has about 20 years' experience in the trade of assembling ones and zeros.
I want to send a special thanks to my partner in life, Elin. Thanks for being there during this special period of time including (but not limited to) moving together, a pandemic, writing a book, and selling a house. And of course to my children, Ville and Lisa, for being an inspiration in life!
Next page