Created
September 25, 2013 18:02
-
-
Save slodge/6703515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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