I want to use a third party view controller that already inherits from UIViewController (https://bitbucket.org/thedillonb/monotouch.slideoutnavigation/src/f4e51488598b/MonoTouch.SlideoutNavigation?at=master), how would I integrate that with MVVMCross?
I could just take the source and change it to inherit from MvxViewController, but guessing I will run into this with other libraries.
Do I need to implement all the interfaces MvxViewController does? IMvxTouchView? IMvxEventSourceViewController?
You can use a custom view presenter like below, This is pretty much straight out of my app using the SlideOutNavigation.
For this particular case, where you don't actually want to do any data-binding so you can just use a custom presenter - e.g. see @Blounty's answer, or see this project demo - https://github.com/fcaico/MvxSlidingPanels.Touch
If you ever do need to convert third party
ViewController
base classes so that they support data-binding, then the easiest way is exactly what you guessed:EventSource
-ViewControllerEventSource
-ViewController to add the Mvx BindingContextThis technique is exactly how
MvvmCross
itself extends each ofUIViewController
,UITableViewController
,UITabBarController
, etc in order to provide data-binding.For example, see:
Note that because C# doesn't have any Multiple-Inhertiance or any true Mixin support, this adaption of ViewControllers does involve a little cut-and-paste, but we have tried to minimise this through the use of event hooks and extension methods.
If it helps, this iOS technique for a previous MvvmCross version was discussed in Integrating Google Mobile Analytics with MVVMCross (obviously this is out of date now - but the general principles kind of remain the same - we adapt an existing viewcontroller via inheritance)
In Android, a similar process is also followed for Activity base classes - see ActionBarSherlock with latest MVVMCross