MonoMobile.MVVM, Round 1
Robert Kozak has started MonoMobile.MVVM, a MVVM framework for Mono on iOS. What this provides, is a great and easy way to work with data-driven applications on the iOS platform. I’ll walk through setting up a simple application with a few elements on it.
We’ll start with MonoDevelop, on the Mac.
When the project loads, you’ll see a couple .xib files in the project. These you can safely ignore for now. Select the project, right click, and goto options. Here you’ll see an option to set the starter .xib file for the application. Go ahead and remove that.
Next we need to add a reference to MonoMobile.MVVM. If you already have downloaded a built the project, add a reference to the project, to the location of the built MonoMoble.MVVM.dll.
Now, in Main.cs, you’ll find a small block of code.
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args);
}
}
Now replace it with the following below. Make sure you add a using MonoMobile.MVVM; so the references work.
public class Application : MonoMobileApplication
{
public static new void Main (string[] args)
{
Run ("Sample", typeof(BasicView), args);
}
}
public class BasicView : View
{
public bool TestOnOff { get; set; }
[Button]
public void PressDown()
{
}
}
Make sure it builds, then we have a working iPhone application.
Now how is the UI built you might ask? Why from BasicView class that we pasted in. It has two elements, a boolean value and a method we applied the button attribute to. So those are the elements that appeared in the UI when we ran it. The UI is generated based upon the data elements in this View Model.
Well, that’s interesting and all, but there’s not a lot going on there. What else can we do? Lots! (Check out the ReadMe in the project for some more ideas)…
public class BasicView : View
{
public bool TestOnOff { get; set; }
[Caption("Why?")]
[Entry]
public string Why { get; set; }
[Section("Actions")]
[Button]
public void PressDown()
{
}
[NavbarButton]
public void Done()
{
}
}





how is this different than MonoTouch.Dialog?
@Jay R. Wren
Per the ReadMe for MonoMobile.MVVM: