Sample code for the 2nd Preview Edition of "Creating Mobile Apps with Xamarin.Forms"
Chapters of the book can be downloaded from http://developer.xamarin.com/guides/cross-platform/xamarin-forms/creating-mobile-apps-xamarin-forms/.
As of April 21, all solutions have been upgraded to Xamarin.Forms 1.4.2. Two additional projects have been added to every solution with the suffixes WinApp and WinPhone81. These projects target the Windows Runtime API in Windows 8.1 and Windows Phone 8.1, respectively.
Because Xamarin.Forms 1.4.2 is a stable release, there is no longer a separate windows-runtime branch.
The support of the Windows Runtime API is still in a early state and not working entirely well. In particular, the following problems will be experienced in the sample programs with the WinApp and WinPhone81 projects:
- Font sizes are somewhat erratic
- The
Accent
color doesn't show up Device.OnPlatform
andOnPlatform
don't account for the two new platforms- The SAP programs in Chapter 9 won't compile
- Most of the programs in Chapter 13 don't work.
To add the Windows Runtime projects to your own Xamarin.Forms solutions, see http://developer.xamarin.com/guides/cross-platform/xamarin-forms/windows/.
The NuGet packages with the Xamarin.Forms libraries are not part of these projects. They must be downloaded for each project.
First load the Libraries/Xamarin.FormsBook.Toolkit solution into Visual Studio. Right-click the solution name in the Solution List and select Manage NuGet Packages for Solution. A notice should appear at the top of the Manage NuGet Packages dialog that says "Some NuGet packages are missing from this solution. Click to restore from you online package sources." Click the Restore button and then the Close button.
You can then load any of the application projects. For each project, again right-click the solution name, select Manage NuGet Packages for Solution and go through the same process.
For some programs, there are some differences between the code listings in the PDF book chapters and those in this repository: In Chapter 7, TextVariations is different because beginning with version 1.3.3, there is no longer a distinction between text as the content of the Label
tags and text as content of the Label.Text
tags. In both cases, whitespace at the beginning and end of the text block is trimmed.
When specifying a local
namespace declaration in XAML, it is no longer necessary to include the assembly name. You can include it if you want, but it's been removed from the ColorListView program in Chapter 8, SharedStatics in Chapter 10, and StackedBitmap in Chapter 13.
The deprecated Font
has been replaced with FontSize
in MonkeyTap and XamlKeypad, both in Chapter 8.