2
votes

I'm trying to build a MonoGame view inside MvvmCross on Android,iOS and WP8. On Windows side it's relatively easy to use dependency properties as a binding target, but how can I achieve a cross platform data binding solution that I can use on all platform?

1

1 Answers

1
votes

This was covered in a previous MvvmCross version - see Insert a Monogame view inside MvvmCross monodroid Activity

The technical details have changes a bit since that post, but the core of the advice remains the same - use inheritance to add data-binding.

For example, if you want to adapt a FooActivity or FooViewController base class so that it can be used for MvvmCross data-binding, then you need to:

  • inherit from FooActivity to provide EventSourceFooActivity - to do this you need to add event notifications like those shown in MvxEventSourceFragmentActivity.cs
  • inherit from EventSourceFooActivity to provide BindingFooActivity - to do this you need to add all the members like DataContext from MvxFragmentActivity.cs

The process for Touch/iOS is very similar, but with iOS specific events and members. Take a look at any of the Mvx*ViewController classes to see what is involved.

This technique is also discussed in: Integrating Google Mobile Analytics with MVVMCross