MvvmCross - MonoGame

若如初见. 提交于 2019-12-11 03:36:51

问题


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:


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



来源:https://stackoverflow.com/questions/17316092/mvvmcross-monogame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!