在MvvmCross中使用Rio的默认绑定

时间:2013-08-13 09:15:53

标签: android xamarin.android mvvmcross

我有一个列表视图,它绑定到一个字符串数组:

<Mvx.MvxListView
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   local:MvxBind="ItemsSource StringArray"
   local:MvxItemTemplate="@layout/listitem_view" />

我的项目模板只是一个文本视图......

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
使用JSON绑定的

...

    local:MvxBind="{'Text':{'Text':''}}" />

再次使用瑞士......

    local:MvxBind="Text " />

但是在将Mvx更新为3.10之后,即使列表仍然绑定到列表视图,我现在也没有得到任何绑定到我的文本视图的内容。 Rio绑定中的语法是否更改了默认行为?

1 个答案:

答案 0 :(得分:1)

3.0.10中没有对此区域进行任何有意更改 - 尽管此问题有Error when making bind ObservableCollection<string> for a MvxListView修正 - 修正为https://github.com/slodge/MvvmCross/commit/d325fb75eaeeb8e470e0ac551f2b69b441f7b285。我相信这已经发布并在3.0.10中用于测试应用程序。

  

Rio绑定中的语法是否更改了默认行为?

我不知道是否有人在MethodBinding或FieldBinding中看到这些问题是Rio扩展的一部分。我没有听说过。


如果这被打破 - 并且取决于是否由于绑定引擎(西藏)或方法和字段扩展(Rio)或其他原因而导致这种情况被破坏,那么可能的解决方法包括:

  • 转离Rio
  • 使用句号“。”替代空白空间 - 例如local:MvxBind="Text ."
  • 向绑定对象添加public object HackSelf { get { return this; }属性并绑定到local:MvxBind="Text HackSelf"
  • 覆盖已注册的绑定引擎(例如,返回瑞士)

如果这被打破了 - 在github上记录问题可能也是一个好主意 - 包括加载的模块,用例,使用的版本,看到的任何可疑跟踪输出以及这里的链接。