Skip to content

Instantly share code, notes, and snippets.

@slodge
Created September 25, 2013 18:02
Show Gist options
  • Save slodge/6703515 to your computer and use it in GitHub Desktop.
Save slodge/6703515 to your computer and use it in GitHub Desktop.
public class MyViewController
: UIViewController
, IMvxBindable
{
public IMvxBindingContext BindingContext { get; set; }
protected override void Dispose(bool disposing)
{
if (disposing)
{
BindingContext.ClearAllBindings();
}
base.Dispose(disposing);
}
public object DataContext
{
get { return BindingContext.DataContext; }
set { BindingContext.DataContext = value; }
}
public MyViewController()
{
this.CreateBindingContext();
DataContext = new MyViewModel();
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// create your UIViews
var set = this.CreateBindingSet<MyViewController, MyViewModel>();
// bind your UIViews
set.Apply();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment