A Sharper Way to work with Xamarin Forms

This is the first of a series of posts covering my new adventures in Xamarin. For those not yet in the know, Xamarin is a cross-platform mobile development system that allows C# programmers to create native iOS and Android applications using the delicious C# language they already know and love. You can read all about the history of Xamarin over on their site but suffice to say it grew out of the Mono project (the first port of C# to non-Microsoft platforms) and so have a very long history with C# and taking it to strange new worlds.

First, a very brief history…

Back in the old days (a year or so ago) if you were to build an iOS application in Xamarin you’d find yourself in a bit of a hybrid world – coding in C# for the “code behind”, common libraries, View Models, etc. but designing the UI either directly in C# code [yuk!] or using Apple’s own “Storyboard” designer [which Xamarin managed to integrate into Visual Studio via a remote Mac connection using dark magic and string theory]. Once you get used to the Storyboard designer you can bust out a completely native iOS interface very quickly, and all the underlying logic code for you app is still in C# – sweet!

So, fast forward to, well, about a month ago (Dec 2014) and Xamarin releases version 1.3 of their kick’n new Forms system (until the 1.3 release I’d have categorized Forms as “interesting but not quite production ready” – I’m sure some would argue). With Forms 1.3 Xamarin has released a very power new UI system that works with a variant of the XAML UI markup language (made famous in Microsoft WPF and Silverlight…don’t be a hater). XAML is actually quite a fantastic markup language, and this release introduces a lot of maturity features like Styles, Triggers, Behaviors, and a whole lot more [great topics for future posts, eh?].

So what’s so cool about Forms that I should care? I mean, that whole Storyboard thing sounded pretty good and it’s been around for a while. Well, here’s the thing; Forms may just be the first time that someone has created a cross-platform UI system that is “write once, run many” and still results in a native application and UI on each platform! That’s right kids, if I create a UI in Xamarin Forms and run it on iOS, I get a fully native iOS UI with real genuine native iOS controls! Take that exact same app and build it for Android, and you guessed it – I get a totally native Android app with a native UI that’s using the native Android controls!

Too good to be true?? I thought so, and until the 1.3 release I watched it evolving while sticking with my Storyboards (the “old” native UI method with Storyboards in iOS and the XML UI builder for Android is still fully supported as “Xamarin Classic”). Now that I’ve been working closely with Forms I’m coming around fast, and part of that is due to a little help from a very impressive Visual Studio plugin.

You see, the one teensy weensy issue with Forms right now is that there’s no UI designer at all – you build the UI entirely in XAML code (just like we did in the early days of WPF and Silverlight…don’t say it). That wouldn’t be too bad except that if you use Visual Studio as your environment you get absolutely NO Intellisense for XAML. You can use Xamarin’s own IDE (Xamarin Studio) where you’ll get very rudimentary Intellisense…barely useful. That means that when you’re first picking up Forms you’re hitting the search engines pretty heavily for every other word or you’d just doing things you shouldn’t from simply a lack of guidance. Enter ReSharper, from the smart folks at Jet Brains.

Now, I didn’t discover this on my own – a friend and mentor of mine at the office turned me on to it; I’d known about ReSharper for years as a cool productivity add-on for Visual Studio, similar to CodeRush or Telerik’s JustCode product. What’s knew, and why you’ll have to pry it from my cold, dead PC, is that ReSharper has added support for Xamarin Forms – you get freak’n full Intellisense for Forms controls in Visual Studio!! How awesome is that?!?!

Needless to say, this has had a huge effect on the Forms learning curve and the productivity gains are just through the roof! There are tons of other coding enhancements that ReSharper brings to the table of course, lots of refactoring, macro expansions, smart suggestions to improve your code, etc. etc. and for a personal license cost of $150 it’s pretty hard to argue with…especially with the new Xamarin Forms support!

ReSharper comes with a 30-day free trial so take it for a spin. If you’re doing anything with Xamarin Forms, definitely take it for a spin!

Tagged , , . Bookmark the permalink.

2 Responses to A Sharper Way to work with Xamarin Forms

  1. Fred says:

    thanks for the heads up, getting ready to embark on an Xamarin.Forms project and was dreading the “no xaml intellisense” scenario but this definitely helps calm my fears, thanks again!

  2. Pingback: Xamarin Weekly Newsletter Issue #26 | Xamarin Fire

Leave a Reply