Recently on his blog, Premier Developer Consultant Joe Healy highlighted some new templates available to Xamarin developers in Visual Studio. See below for the full article, but also be sure to check out Joe’s DevFish blog for lots more great content!
Xamarin has some great documentation. The article at [ https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/getting_started_with_xaml/ ] shows how to get started with Xaml by using the Blank Xaml App ( Xamarin.Forms Portable ) template.
Xamarin New Forms Portable
The Blank Xaml App template sets up a project without any Xaml, just C# classes for creating a Xamarin Forms project. You must manually add a Xaml Page to this template, as this article shows [ https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/getting_started_with_xaml/].
In my article at [ https://blogs.msdn.microsoft.com/devfish/2016/06/24/global-resources-in-xamarin-forms-no-app-xaml-create-one/] I show how to add an App.Xaml to the Blank Xaml App template as well. App.xaml using xml gives a developer Xaml based resources and style definitions, imho a much cleaner and manageable approach than C# based repositories.
Xamarin New Forms PCL App
Manually adding in XAML pages works very well. Functional? Yes! Tedious, absolutely.Wish there was an easier way? Of course.
Good news. XAML templates are here.
Update your Xamarin to at least Xamarin 4.1, and new templates are available. My very favorit-est is the Blank Xaml App ( Xamarin.Forms Portable ). Blank Xaml App versus Blank App? Blank Xaml App gives us App.Xaml and App.Xaml.cs, as well as MainPage.xaml and MainPage.Xaml.cs files.
Developers no longer have to have to manually add in the Xaml page, or an App.Xaml . Great news for those of us who prefer the pointy thing approach < xaml /> to form layout versus C# driven.
Prior to Xamarin 4.1 we were forced to use the Xaml App template with manually added XAML forms if we wanted to use XAML instead of code.
Note this is also available in Xamarin Studio on the Mac, via the File > New > Solution > Xamarin.Forms > Forms App. Keep a sharp watch, as the default page in Xamarin STudio for Mac will match the name of the project instead of being “MainPage.xaml”.
Xamarin Forms keeps getting better. I can’t wait to see where it goes. But in the meantime, the new default layout with Xaml based pages gives us pointy types a much better launchpad for our projects than the previous C# only options.
Happy coding and tight lines!
0 comments