【问题标题】:Error when making bind ObservableCollection<string> for a MvxListView为 MvxListView 绑定 ObservableCollection<string> 时出错
【发布时间】:2013-07-19 01:16:32
【问题描述】:

在为最后一个版本更新 MvvmCross 后,我开始遇到错误:

MvxBind:Error:1679,46 视图绑定时抛出的异常 MvxException: Unknown serialized description.

此错误仅发生在此绑定中。如果我确实绑定了

ObservableCollection<Class A>

一切正常。

我有一个 MVXListView 的模板:

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:local="http://schemas.android.com/apk/res-auto"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <include
            layout="@layout/PageCommon_Titlebar" />
        <Mvx.MvxListView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:gravity="center_horizontal"
            android:paddingLeft="12dp"
            local:MvxItemTemplate="@layout/listitem_sentences"
            local:MvxBind="ItemsSource Sentences, Mode=OneWay; ItemClick SelectSentenceCommand" />
    </LinearLayout>

和列表行的模板:

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
  <TextView
      android:id="@+id/SentenceTextView"
      android:layout_width="fill_parent"
      android:layout_height="70dp"
      android:padding="10dp"
      android:textSize="24dp"
      local:MvxBind="Text "  
    />
</LinearLayout>

现在这不正确吗? 对于 WP8,我们可以这样做:

   <TextBlock Grid.Row="0" 
     Margin="10,10,10, 3" HorizontalAlignment="Stretch"
     Style="{StaticResource PhoneTextTitle2Style}"
     Text="{Binding}"/>

提前感谢您的帮助

【问题讨论】:

    标签: xamarin.android xamarin mvvmcross


    【解决方案1】:

    看起来在默认(整个对象)绑定的某个地方一定存在回归。

    作为一种解决方法,我知道我今天早上使用的应用程序使用以下绑定:

      local:MvxBind="Text ."
    

    我会将回归记录为一个问题(除非你打败了我)

    【讨论】:

    猜你喜欢
    • 2018-09-11
    • 2015-08-10
    • 1970-01-01
    • 2013-08-05
    • 2011-02-15
    • 2013-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多