Search code examples
iosxamarinmvvmcross

MVVMCROSS ShowViewModel-Navigation Inherited Class


Is there a way to do ShoViewModel-Navigation with own inherited classes with mvvmcross? For example:

public class myviewcontroller:MvxViewController

Inherited ViewController:

public class myInheritedViewController:myviewcontroller

Problem is similiar to: MVVMCROSS Ios Binding ShowViewModel but base.viewdidload() won't solve the problem here.


Solution

  • You can adapt any ViewController base class to allow binding by inheriting from it to provide the MvvmCross data-binding extensions.

    For example, see how UIViewController itself is adapted in 2 layers of inheritance:

    There's more on this in a few other questions here on StackOverflow - e.g. see Integrating third party controller with MVVMCross on MonoTouch