Creating Mobile Apps with Xamarin.Forms book
The book Creating Mobile Apps with Xamarin.Forms by Charles Petzold is a guide for learning how to write Xamarin.Forms applications. The only prerequisite is knowlege of the C# programming language. The book provides an extensive exploration into the Xamarin.Forms user interface and also covers animation, MVVM, triggers, behaviors, custom layouts, custom renderers, and much more.
The book was published in the spring of 2016, and has not been updated since then. There is much in the book that remains valuable, but some of the material is outdated, and some topics are no longer entirely correct or complete.
Download eBook for free
Download your preferred eBook format from Microsoft Virtual Academy:
You can also download individual chapters as PDF files.
The samples are available on github, and include projects for iOS, Android, and the Universal Windows Platform (UWP). (Xamarin.Forms no longer supports Windows 10 Mobile, but Xamarin.Forms applications will run on the Windows 10 desktop.)
Chapter summaries are available in the chapter table show below. These summaries describe the contents of each chapter, and include several types of links:
Links to the actual chapters of the book (at the bottom of the page), and to related articles
Links to all the samples in the xamarin-forms-book-samples GitHub repository
Links to the API documentation for more detailed descriptions of Xamarin.Forms classes, structures, properties, enumerations, and so forth
These summaries also indicate when material in the chapter might be somewhat outdated.
Download chapters and summaries
|Chapter 1. How Does Xamarin.Forms Fit In?||Download PDF||Summary|
|Chapter 2. Anatomy of an App||Download PDF||Summary|
|Chapter 3. Deeper into Text||Download PDF||Summary|
|Chapter 4. Scrolling the Stack||Download PDF||Summary|
|Chapter 5. Dealing with Sizes||Download PDF||Summary|
|Chapter 6. Button Clicks||Download PDF||Summary|
|Chapter 7. XAML vs. Code||Download PDF||Summary|
|Chapter 8. Code and XAML in Harmony||Download PDF||Summary|
|Chapter 9. Platform-Specific API Calls||Download PDF||Summary|
|Chapter 10. XAML Markup Extensions||Download PDF||Summary|
|Chapter 11. The Bindable Infrastructure||Download PDF||Summary|
|Chapter 12. Styles||Download PDF||Summary|
|Chapter 13. Bitmaps||Download PDF||Summary|
|Chapter 14. Absolute Layout||Download PDF||Summary|
|Chapter 15. The Interactive Interface||Download PDF||Summary|
|Chapter 16. Data Binding||Download PDF||Summary|
|Chapter 17. Mastering the Grid||Download PDF||Summary|
|Chapter 18. MVVM||Download PDF||Summary|
|Chapter 19. Collection Views||Download PDF||Summary|
|Chapter 20. Async and File I/O||Download PDF||Summary|
|Chapter 21. Transforms||Download PDF||Summary|
|Chapter 22. Animation||Download PDF||Summary|
|Chapter 23. Triggers and Behaviors||Download PDF||Summary|
|Chapter 24. Page Navigation||Download PDF||Summary|
|Chapter 25. Page Varieties||Download PDF||Summary|
|Chapter 26. Custom Layouts||Download PDF||Summary|
|Chapter 27. Custom renderers||Download PDF||Summary|
|Chapter 28. Location and Maps||Download PDF||Summary|
Ways in which the book is outdated
Since the publication of Creating Mobile Apps with Xamarin.Forms, several new features have been added to Xamarin.Forms. These new features are described in individual articles in the Xamarin.Forms documentation.
Other changes have caused some of the content of the book to be outdated:
.NET Standard 2.0 libraries have replaced Portable Class Libraries
A Xamarin.Forms application generally uses a library to share code among the different platforms. Originally, this was a Portable Class Library (PCL). There are many references to PCLs throughout the book and the chapter summaries.
The Portable Class Library has been replaced with a .NET Standard 2.0 library, as described in the article .NET Standard 2.0 Support in Xamarin.Forms. All the sample code from the book has been updated to use .NET Standard 2.0 libraries.
Most of the information in the book concerning the role of the Portable Class Library remains the same for a .NET Standard 2.0 library. One difference is that only a PCL has a numeric "profile." Also, there are some advantages to .NET Standard 2.0 libraries. For example, Chapter 20, Async and File I/O describes how to use the underlying platforms for performing file I/O. This is no longer necessary. The .NET Standard 2.0 library supports the familiar System.IO classes for all Xamarin.Forms platforms.
The role of XAML has been elevated
Creating Mobile Apps with Xamarin.Forms begins by describing how to write Xamarin.Forms applications using C#. The Extensible Application Markup Language (XAML) isn't introduced until Chapter 7. XAML vs. Code.
XAML now has a much larger role in Xamarin.Forms. The Xamarin.Forms solution templates distributed with Visual Studio create XAML-based page files. A developer using Xamarin.Forms should become familiar with XAML as early as possible. The eXtensible Application Markup Language (XAML) section of the Xamarin.Forms documentation contains several articles about XAML to get you started.
Xamarin.Forms no longer supports Windows 8.1 and Windows Phone 8.1.
The book sometimes makes references to the Windows Runtime. This is a term that encompasses the Windows API used in several versions of Windows and Windows Phone. More recent versions of Xamarin.Forms restricts itself to supporting the Universal Windows Platform, which is the API for Windows 10 and Windows 10 Mobile.
A .NET Standard 2.0 library does not support any version of Windows 10 Mobile. Therefore, a Xamarin.Forms application using a .NET Standard library will not run on a Windows 10 Mobile device. Xamarin.Forms applications continue to run on the Windows 10 desktop, versions 10.0.16299.0 and above.
The chapter summaries include information concerning changes in Xamarin.Forms since the book was written. These are often in the form of notes:
Notes on each page indicate where Xamarin.Forms has diverged from the material presented in the book.
In the xamarin-forms-book-samples GitHub repository, the original-code-from-book branch contains program samples consistent with the book. The master branch contains projects that have been upgraded to remove deprecated APIs and reflect enhanced APIs. In addition, the Android projects in the master branch have been upgraded for Android Material Design via AppCompat and will generally display black text on a white background.