Skip to content

Instantly share code, notes, and snippets.

@rid00z
Last active December 22, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rid00z/6532949 to your computer and use it in GitHub Desktop.
Save rid00z/6532949 to your computer and use it in GitHub Desktop.
ios Bindable View. Required because of limitations with ViewController, specifically ViewControllers always require a NavigationController which we don't want on all views.
public class MvxBindableView : MvxView, IMvxTouchView, IMvxEventSourceViewController
{
public event EventHandler ViewDidLoadCalled;
public event EventHandler<MvxValueEventArgs<bool>> ViewWillAppearCalled;
public event EventHandler<MvxValueEventArgs<bool>> ViewDidAppearCalled;
public event EventHandler<MvxValueEventArgs<bool>> ViewDidDisappearCalled;
public event EventHandler<MvxValueEventArgs<bool>> ViewWillDisappearCalled;
public event EventHandler DisposeCalled;
#region IMvxTouchView implementation
MvxViewModelRequest _request;
MvxViewModelRequest IMvxTouchView.Request
{
get
{
return _request;
}
set
{
_request = value;
}
}
#endregion
#region IMvxView implementation
protected IMvxViewModel _viewModel;
IMvxViewModel Cirrious.MvvmCross.Views.IMvxView.ViewModel {
get { return _viewModel; }
set
{
_viewModel = value;
DataContext = _viewModel;
}
}
#endregion
public MvxBindableView ()
{
BindingContext = new MvxBindingContext();
}
public virtual void Load()
{
MvxViewControllerExtensionMethods.OnViewCreate (this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment