Saturday, March 30, 2013

Hot Tuna goes Beta, tastes of Nuget ... and Daniel Plaisted gets the biggest hottest fishiest badge of awesomeness yet seen!

Thanks to everyone who's been playing with Hot Tuna as it's gone through some pretty hefty Alpha changes!

The good news is that today MvvmCross v3 is now officially in Beta. 

This means that the API is now 'locked off' - I will try not to make any more structural changes (e.g. renaming key Mvvm classes or moving them between namespaces) - indeed I'm hoping I won't make (m)any more changes at all...

This means you can now start to code against v3 safe in the knowledge that you are coding against a 'near final' version :)

There may still be additions made to Hot Tuna - there are a few open issues still to resolve - but overall it's stable now - and I love it :) :) :)


To celebrate, I've spent most of the last 24 hours playing with Nuget packages. You can see them on the nuget prerelease channel:

These packages are very new, but:
  • should 'mostly' work for WindowsPhone and Xamarin.Android inside VS2012
  • will 'on the whole' work with WindowsStore
  • 'only partly' work for WPF - we just don't have that many plugins yet for WPF
  • won't work at all for Xamarin.iOS - but should work as soon as Xamarin ship their PCL support...

To work with these nuget packages, you need to:

  1. Install the very latest builds of nuget - from - these are builds of the upcoming v2.5 release
  2. Install an XML file for PCL for Xamarin.Android - like this one - it needs to go in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile104\SupportedFrameworks
  3. Make sure you are looking at pre-release packages inside Nuget - these packages will not show up in 'stable only'

Here's a quick (and rather rough) video of these packages at work:

I can't shout loudly enough about how ecstatic I am to have nuget working like this with Xamarin.Android. Mr Daniel Plaisted put in heaps of effort to make this happen... he logged hours on Xmas day last year through to Good Friday yesterday.

This is the Biggest Hottest Fishiest badge of awesomeness ever - @dsplaisted you are officially awesome 3 times over! Thank you Daniel!

Friday, March 29, 2013

Awesome feedback - helping MvvmCross presentations Evolve for the better! Lee Oades - wow - thank you - Awesome!

This week, I gave my first Hot Tuna talk at Modern Jago in London

In all honesty, it was a warm up talk for Evolve and I was a bit ropey - sorry guys, I'd been so busy coding for the release that I'd left preparing for the talk until too late....

However, fortunately I survived - and I think all the fab Windows Store developers understood most of my message :)

And one of them....

Well, one of them was Lee Oades a dev who describes himself:
Pro C# Developer, photographer, guitar player, poker player and proud husband & father of two
 ... I think this means two children, not two wives ;)

And yesterday, he followed up with the most fabulously detailed set of notes about where the talk was bad, bits that worked, bits that could have been better, how his dev friend had seen it and generally what would make it even more awesome. Beyond the summary text there were 18 (18!) really good points to look to improve

This is fabulous... totally fabulous... it gives me I can get on with preparing for Evolve - where MvvmCross will be at it's Hottest and most Tuna-esque

Lee, thank you - 100% awesome - grab an awesomeness badge and take a bow:

Also... very much looking forwards to seeing Lee talk in the future - the return favour will be my pleasure ;)

Fixing the Spinner control - Now That's What I Call Bug Hunting - Hugo gagne un insigne d'awesomeness

Hot Tuna is almost Beta....

But officially it's still Alpha

And I'm 'totally stoked' that so many people are already using it :)

One such person is long-time user - Hugo Terelle - and this week he reported that the Android Spinner binding was broken....

... but he didn't just report it....

... he also fixed it...

.... and he also supplied a test repo on GitHub to make it quick and easy to confirm the fix.

Hugo - Thanks - Now That's What I Call Bug Hunting - and deserving of a Badge of Alpha Tuna Awesomeness:

Note: I *think* Hugo's the one on the right in this picture - but I'm sure the one on the left is also writing awesome code already :)

Conventional Views - from the Badge winning Camel - pure genius!

Last weekend, I got a tweet... just a few characters from Johan Otto - also known as: @MorbidCamel 

How about a custom attribute for views like [ViewModel(typeof(MyMvxViewModel))] alternative to naming convention reflection in Setup

This was a Tweet that HotTuna really needed....

This sort of thing has been discussed before... and I knew it was there... but recently I'd been spending so much time just GettingThingsWorking(TM) that I'd missed the obvious...

So I'm delighted to say that now in MvvmCross v3 if you have a ViewModel like:

Then you can simply declare a view for it like any of:

Really this is awesome - totally awesome - I've now switched all my apps to this - it is just so obviously good - it's lovely.

Not only that... but this Tweet served as a reminder for MvvmCross back to one its roots - back to CoC - Convention over Configuration - something that we've been trying to do since v0.

Thank you @MorbidCamel - you helped make the #HotTuna even Hotter.

100% Awesome - this badge is for a Conventional-not-Configured hero called Johan Otto:

Thank you Johan - pure genius!

Fixing Mvvm Commands - Making Hot Tuna better - @XamlDude bags a Tuna flavored Badge of Awesomeness

Last week @xamldude posted an interesting blog post on ICommands might be 'improved' -

Not everyone agreed with the post - a few notable names said it was an already solved problem - that, code snippets, for example negated the need for this.



... I loved the idea.

So, MvvmCross v3 is going to ship with a new class - MvxCommandCollection

This class allows you to write and expose your ICommands as methods.

After you've done this, then the commands can be accessed in XAML or AXML using markup like:

This approach won't be to everyone's tastes - but I love it - it gives users the choice to just name methods ending with 'Command' and these will automatically translate to ICommand's

Behind the scene's there's also more going on too - e.g.  you can use parameterised commands, and you can use CanExecuteCommandName properties to enable/disable the Commands too. I will try to explain that more fully another day...

For now... @xamldude this was an awesome post - there's only one way to say 'thank you' - with a badge of Hot Tuna MvvmCross awesomeness:

Awesome @xamldude Awesome!

Thursday, March 28, 2013

An MvvmCross technical day in London - Feedback on date needed!

I'm in the final stage of organising this now :)

An MvvmCross technical day in London - a whole day of techie talks, hands-on coding and pure C# and Mvvm :)

If you're interested - and if you'd like to help influence the date (there are only two choices so far), then please give me your opinion today on:

Sunday, March 24, 2013

v3 TipCalc sample on CodeProject

Just following up from the post this week about the first of the v3 documents...

As well as publishing on the GitHub wiki - - the lovely people at CodeProject have also published the TipCalc sample.

It's online now at:

I'll keep working on more docs... you... all please keep the feedback coming :)

Friday, March 22, 2013

Binding the ViewPager with MvvmCross - part 2! Awesome with Double Cheese!

Last month we got an awesome submission from Steve Dunford at Sequence - a ViewPager which could be data-bound for use in MvvmCross.Android -

This month, the legend that is @CheeseBaron has taken this Gist further, bug fixed it, extended it and published a sample on a proper GitHub repo

Check it out at - with Xamarin 1.0 dlls included.

The Android View and ViewModel code is so simple and clean - it's gorgeous!

Check it out -

In fact... it's better than gorgeous... it's awesome!

CheeseBaron - thank you, sir - you are awesome twice over!

Thursday, March 21, 2013

Xamarin.iOS with MvvmCross in VS2012 - "The current project does not support references to Portable Library projects."

If you see this message in VS2012 with Xamarin.iOS working with MvvmCross

Unable to add a reference to project 'MyApp.Core'. The current project does not support references to Portable Library projects.

then this may be because you have not yet got PCL support added for MonoTouch (Xamarin.iOS)

To add this, create a new file



C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile104\SupportedFrameworks

with contents:

Hot Tuna docs... MvvmCross v3 - slowly progressing...

I am slowly kicking through documentation for HotTuna, starting with ... Getting started.

The first few installments are now on:

Coming next will be the WindowsPhone and WinRT UIs - which I probably will cover in less detail.

After this first tutorial is done I'll start on other samples and walk-throughs, moving on from the intro and covering more advanced topics....

You'll notice I'm currently not saying too much about where to get files from or how to setup the IDEs for PCLs... this is partly because this area is changing a lot right now - so I think the docs could be out of date every week if I try to explain too much.

These are taking a lot of time to produce...

  • Are they worth it? 
  • Is there something else you'd prefer to see instead?
  • Or as well?
  • Feedback always welcome!

Wednesday, March 20, 2013

The MvvmCross Manifesto - Draft 1

MvvmCross is opinionated. It cares about how you write your code. Its opinions are:
  • Portability – you should use Portable Class Libraries for as much of your code as you possibly can - viewmodel, model, service and even view. Friends don’t let friends copy and paste. # is for twitter, not for code.
  • Interface Driven Development – you should use Dependency Injection, Inversion of Control and Plugins to get your applications richly and robustly to market on all of your target platforms.
  • Code for Test – you should use interfaces; you should develop small, cohesive, loosely coupled components; and you should add unit tests to allow your code to be used, reshaped and reused again and again.
  • Mvvm – you should use architectural patterns - especially Model-View-ViewModel with Data-Binding - in order to provide a structure within your app, and in order to deliver both a delightful application and a sustainable, flexible ongoing development process.
  • Native UIs – users love Native, and you should give them Native UIs that delight, that provide rich functionality and that are styled to fit naturally in the context of your users’ devices.
  • Your opinions matter – you should be able to override any part of MvvmCross, including it’s opinions.
  • The app is King –  more than anything else, what matters is that you ship. Delivering is everything. The app is King.

Tuesday, March 19, 2013

An Awesome Introduction to Mvvm on Xamarin.Android and Xamarin.iOS - from TechDays BE

A month ago, @gshackles raised the quality bar with his superb Building Android Apps with Mvvm and DataBinding article

Ladies and Gentlemen....

Today the bar has been raised again

A video from TechDays Belgium has been published today - and in it Gitte Titter provides just about the perfect introduction to cross platform Mvvm for existing Windows Mvvm developers.

And all of this in front of a huge and particularly rough looking audience...

For this AWESOME talk, Gitte, thank you....

... and hugely well done on becoming the first lady double-badger!

TeaLight... a T4 generation framework for MvvmCross applications - you know what... it's Awesome!

A trio from Avenade got in touch during February.

@jonkeda,  Matthijs van der Veer, and Jermaine Jong have together been building TeaLight - a huge and hugely impressive code generation framework for Business applications on top of Mvvm.

Featuring multi-platform support, local-remote data-synchronisation, customisable UI generation and automated testing, this framework builds on top of T4 templates and provides app generation direct from business definitions.

They presented this framework to an audience of over 80 at TechDays NL at the start of March, and are currently looking forwards to extending it to support Async, Nuget and more. If anyone else is interested and wants to get involved, then check out their wiki as the project builds and evolves on

For a really cool project, for beating brutal deadlines, and for truely delivering on the developers rule that real developers automate, I'm delighted to send out the first Netherlander Badge Van Awesomeness. Excellent stuff:

ALM2GO - an MvvmCross project management tracker ... and Alexey grabs a Badge of Awesomeness

SeeD-Seifer also known as Alexey has been in touch a few times over the last few months - including helping out with a few bugs and issues, especially around Dialog functionality.

I've now just found out that he and the team at ArtOfBytes have recently shipped ALM2GO - a super clean looking project tracking tool for iPhone.

This tool is built on top of MvvmCross, especially using Dialog functionality and it looks great - you can get it today from:

For shipping such a great MvvmCross/Dialog app, and for long-term services to Dialog, I'm really, really pleased to award Alexey a Badge Of Awesomeness!

It's great to see slick, delightful, robust business apps shipping on top of MvvmCross - awesome work by all in Hamburg and the Ukraine!

Friday, March 15, 2013

V3 code reaches Alpha...

Hot Tuna!

If you're interested in v3, then the code in GitHub builds and runs on Xamarin 2.0 code:

  • Xamarin.Android, WinRT, WPF and WindowsPhone all build and run on VS2012 on PC (Debug profile tested)
  • Xamarin.iOS builds and runs on the Mac for iPhoneSimulator
Xamarin.iOS doesn't yet build within VS2012 - there are problems with integrating System.Windows.ICommand

If you want to play... then it is Alpha... but it is the future - so please do :)

It's all on the v3 branch:

Hot Tuna!

Wednesday, March 13, 2013

Hot Tuna Training and Hacking - who's interested?

I'm currently trying to set up a day in London early this Summer for some Hot Tuna learning and hacking.

I've not got a solid date for this yet, nor any fixed idea on what the format should be

Also I'm not really too sure how many people might actually want to attend.

To collect some kind of feedback on this... I thought I'd ask a few questions.

If we organised:
  • a *free* weekday one day event in central London 
  • during May 
  • targeted at Mvvm Cross-Platform development 
  • including talks/demos about C# on all of Win8, WP8, Android and iOS
  • including some talks and some hands-on code
then who might be interested?

Tweet me, email me, or comment on here to let me know if you would be interested.

Also... would it make you more or less interested:
  • if we switched it to a weekend day?
  • if we opened it up to non-Mvvm coding?
  • if we opened it up to MonoGame coding?
  • if we made it include more hands-on coding time?
  • if we made it include more formal talks?
  • if we charged a small amount to cover food and drink?
Interested to hear your thoughts.

A Chimp is born.... Mvvm on MonoDroid without MvvmCross

One of the goals of MvvmCross v3, Hot Tuna, is to allow other Mvvm and non-Mvvm libraries to take advantage of MvvmCross Plugins and MvvmCross Data-Binding without the developers having to buy into the entire MvvmCross experience.

For reasons I can't quite remember, this part of the project got the codename Chimp.


The good news is that today a Chimp is born!


The source of a first demo is in:

This demo just has:
  • a simple INotifyPropertyChanged ViewModel
  • a simple Activity with an MvxBindingContext added
  • some simple AXML with some Swiss MvxBind statements inside

Importantly, this demo has references to only:
  • the very smallest core parts of MvvmCross - the CoreCross library
  • the MvvmCross.Binding libraries

On top of these references, I've added just a small amount of Setup infrastructure for starting IoC, Trace, etc, and this then allows the binding code to work for our simple View and ViewModel


To get to this stage has required turning MvvmCross completely upside-down in terms of dependencies... but I'm excited that we've now reached this result.

I'll try to add another demo or two in the next couple of days - but really... this is now an invitation to others - does anyone want to see if the Chimp will walk with their favorite Mvvm platform?

Tuesday, March 12, 2013

Hot Tuna Fragments

v3 of MvvmCross finally brings some Android Fragment action to MvvmCross

The integration is still a work in progress, but you can see some Fragment binding in

This sample shows some basic principles:

- A fragment declared in AXML and it's DataContext (ViewModel) set in Code Behind

- Fragment switched in/out of a ViewGroup container programmatically using Code Behind

- Fragments loaded into Tabs

- Fragments used in Dialogs


There's still plenty more to learn and explore in these Fragments - the lifecycle of fragments really is a bit odd... so this code isn't really fully production ready yet...

There's also quite a few other things to try - like maps, view pagers and bound fragment collections...

But at least fragments can now be used and can be easily data-bound :)

NotSupportedException during HTTP Post - EndGetRequestStream

If you're making an HTTP Post on WP7/WP8 and you get back an annoying NotSupportedException, then one thing i might be is that you forgot to Flush/Close/Dispose the Request stream.

i.e. make sure that you do the `using` part of:

Monday, March 11, 2013

V3 - a new ViewModel lifecycle

One of the changes coming in MvvmCross v3 - Hot Tuna - is that the default ViewModel location and construction has been overhauled to provide 3 new features:

  • constructor based Dependency Injection
  • navigation using Typed navigation classes
  • saving and reloading VM state for 'tombstoning'

I'm sorry that these changes are breaking changes for existing v1 and vNext apps.

However, I hope we'll all find these changes very useful in the future.

How ViewModels are Created in v3

The default ViewModelLocator in v3 builds new ViewModel instances using a 4-step process - CIRS:
  1. Construction - using IoC for Dependency Injection
  2. Init() - initialisation of navigation parameters
  3. ReloadState() - rehydration after tombstoning
  4. Start() - called when initialisation and rehydration are complete


As in vNext, you navigate to a ViewModel using arguments like:

In vNext, these navigation parameters were passed to the constructor of the ViewModel.

However, in v3, these navigation parameters are instead passed to the Init() method, and the constructor is now free to be used for Dependency Injection.

This means that, for example, a DetailViewModel constructor might now look like:

This Dependency Injection is, of course, optional - you code can instead continue to use ServiceLocation if you prefer:


Now that the construction is used for Dependency Injection, the navigation parameters move to a new method - Init()

Init() will always be called after construction and before ReloadState() and Start()

Init() can come in several flavors:.
  • individual simply-Typed parameters
  • a single Typed parameter object with simply-Typed properties
  • as InitFromBundle() with an IMvxBundle parameter - this last flavor is always supported via the IMvxViewModel interface.
You can declare zero or more of each of these types, but generally you will probably only want to use one within your application

So, for example, to support the navigation:

you could implement any of:



Note that multiple calls can be used together if required. This allows for some separation of logic in your code:


If the View/ViewModel is recovering from a Tombstoned state, then ReloadState will be called with the data needed for rehydration.

If there is no saved state then no ReloadState() methods will be called. 

Exactly as with Init(), ReloadState can be called in several different ways.
  • individual simply-Typed parameters
  • a single Typed parameter object with simply-Typed properties
  • as ReloadStateFromBundle() using an IMvxBundle parameter - this last flavor is always supported via the IMvxViewModel interface.
Normally, I'd expect this to be called as:

Aside: where does the SavedState come from?

One of the new ViewModel APIs available in Hot Tuna is a SaveState pattern.

This can be implemented in one of two ways:
- using one or more paremeterless methods that return Typed state objects
- using the override SavedStateToBundle(IMvxBundle bundle)

Using a Typed state object:

Using SavedStateToBundle:


After all of Construction, Init, and ReloadState is complete, then the Start() method will be called.

This method is simply:

Putting it all together

For a real app, I would expect the navigation, construction and state saving/loading code to actually look like:


Oh yuk - I hate it - this CIRS stuff is not for me....

If you don't like this CIRS flow for building your ViewModels, then the good news is that you can easily override the ViewModelLocator within v3, just as you could within vNext :)

You can easily go back to vNext style ViewModel construction - or you can easily invent something new.

Oh yes - I love it - when can I use it?

Soon... very soon ... 

... well, just as soon as I work out some of this MonoTouch->Xamarin.iOS pain :/

Friday, March 01, 2013

Hot Tuna - MvvmCross v3 progress

The work on MvvmCross v3 is picking up pace :)

The current tip of the v3 code is on and I'm now beginning to build my first customer project using v3.

MvvmCross - v3 - Hot Tuna

Most of the progress continues to be over weekends - but I'm planning on investing some serious time on v3 during March.

The current v3 status is still very much Alpha - names, namespaces, apis, and functionality may all still change - so I don't recommend using v3 unless (like me) you like pain.

But if you do try to use v3, then I'd love to hear from you ;)

Some more advice for intrepid adventurers who want to fish for some Hot Tuna:
  • As with previous versions, the best documentation today is the samples - but I am looking to change this.
  • There are a large number of changes from master and vNext - especially when it comes to namespaces and class names. I will try to explain this more in blog posts during March.
  • There are some big structural changes in v3 - especially the introduction of CoreCross, and the reversal of dependencies between MvvmCross and the Data-Binding code. I will try to explain this more in blog posts during March.
  • If porting code from vNext to v3, then there are some tedious changes to make. I will try to explain these more in blog posts during March:
    • Views to change from generic to non-generic
    • Namespaces to move
    • Project references to change
    • IoC to switch over to the new syntax
    • Problems with Xamarin2.0 to overcome
    • ... and more besides!

If you would like an insight into v3, then I've prepared this slide deck as an introduction:

I'm still loving MvvmCross and cross-platform C# development - the future is bright, databound, and portable :)