Create F# ViewModel for WinRT app

Last night I gave a talk about WinRT and Caliburn.Micro at the Nashville .NET User group meeting. Caliburn.Micro is a popular MVVM framework for XAML-based application like WPF, Silverlight, and Windows Phone.

In the talk, I mentioned about using F# in the model part of the sample WinRT app. And that got attention from couple of members from NashFP who also use F#. The discussion lead me to consider using F# for the ViewModel part, so I did some research and found that F# developers have written articles and samples about using F# in ViewModel for other XAML-based application like WPF and Silverlight already.

So I try building a sample WinRT app and use ViewModelBase and RelayCommand implementation from “F# Windows App (WPF, MVVM)” template created by a fellow Nashvillian, Daniel Mohl.

Here is some code for View (XAML), ViewModel, RelayCommand, ViewModelBase:

And here is a screenshot from the app:



As F# is one of CLI languages and works fine in any CLR, everything works perfectly on WinRT as well.

You can found a full solution here.

Happy coding!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s