Last month Xamarin presented Xamarin 3.0, a refresh on the Xamarin suite of tools to build cross platform apps with C#. There were 4 major announcements but
i personally got really excited by the new library Xamarin.Forms.
Xamarin.Forms is a cross platform library that allows you to build native user interfaces for IOS, Android and Windows Phone with C# and… get ready for it … XAML!!! YES! Xamarin choose to add XAML as the markup language to also build our pages and controls. Before you get too excited this is not the Microsoft XAML subset you may know. The XAML story in Xamarin is that you can use XAML to write your code, but the controls and way it works is particular to Xamarin. You still have a lot of common things like DataBinding, Commands, Resources, Converters, some identical layouts like Grid or StackLayout (StackPanel) and controls like the ListView, the data template for items is also similar. Another great power of Xamarin.Forms library is that allows you to plug in renderers in each platform native implementations. Renderers extend the way a particular control is shown, allowing you to tweak the parameters of a particular control or replace it completely with your own. There is also a DependencyService built in to hook up native implementations of any API. For the DependencyService to work you need an interface of the service in your core project and native implementation of it with a special attribute in each platform.
After playing with the new components, I started to write some code like it was Microsoft XAML. There are some basic things you need like the ViewModel base and RelayCommand, then you write more code and you need a converter. Finally you get to a point you want to tweak something and after searching you find a post on the forum that says that for that particular property you need to write a custom renderer. So you write your first renderer and start to play with some native services. Eventually you feel like the built-in DependecyService isn’t quite good enough to register your custom services, so you implement a simple DI container or get a PCL nuget to work.
The basics were all there, but we had found holes the Xamarin.Forms team had not found or not plugged yet. So I started a repository on GitHub called Xamarin.Forms.Toolkit and this thread on the forum. The idea was to work on a common toolkit tailored for the brand new Xamarin.Forms. From there we changed the name to XForms.Toolkit because of the potential for a namespace conflict, however we ended up changing to Xamarin.Forms.Labs after talking to Jason from the Xamarin.Forms team. The Xamarin.Forms team “granted” us permission to use the namespace so we don’t run into issues.
So the remarkable thing is that in just 20 days the fantastic Xamarin/Dotnet community contributed to the project, i asked some people to collaborate others just joined in, and we have almost 200 commits, 9 active contributors, cool subset of controls and services and even nuget packages to help you bootstrap your Xamarin Forms application.
Check the project out on Github:
GitHub Repository : https://github.com/XForms/Xamarin-Forms-Labs
Wiki (WIP) : https://github.com/XForms/Xamarin-Forms-Labs/wiki
Submit bugs and issues : https://github.com/XForms/Xamarin-Forms-Labs/issues?milestone=2
- Calendar Control (beta)
- ImageButton (beta)
- ExtendedLabel (beta)
- ExtendedViewCell (beta)
- ExtendedTextCell (beta)
- AutoComplete (beta)
- HybridWebView (alpha)
Available services (Beta)
- Text To Speech
- Device (battery info, device info, sensors, accelerometers)
- Phone Service (cellular network info, make phonecalls)
- Camera (Picture and Video picker, Take Picture, Take Video)
Available Mvvm helpers (Beta)
- ViewModelBase (navigation, isbusy)
- RelayCommand ; RelayCommand< T >
- IXFormsApp (application events)
Available Plugins (Beta)
- Serialization (ServiceStackV3,ProtoBuf,JSON.Net)
- Caching (SQLLiteSimpleCache)
- Dependency Injection containers (TinyIOC,Autofac,NInject,SimpleInjector)
I will write further blog posts about to each subset and feature.
Big thanks Xamarin for building great products, the Xamarin Forms team for being so useful with solving issues and getting feedback from the community, to everyone helping the project by spreading the word on twitter, testing, using it , raising issues, and special thanks to the main contributors :