Error when making bind ObservableCollection

2019-07-31 17:47发布

问题:

After update MvvmCross for the last version, i started having an error:

MvxBind:Error:1679,46 Exception thrown during the view binding MvxException: Unknown serialized description.

This error occurs only in this bind. If i do bind for a

ObservableCollection<Class A>

everything works fine.

I have a template for 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>

and a template for list rows:

<?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>

Is this incorrect now? For WP8 we can do:

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

Thanks in advance for help

回答1:

It looks like there must be a regression somewhere with the default (whole object) binding.

As a workaround, I know that the app I was working with this morning worked with a binding of:

  local:MvxBind="Text ."

I'll log the regression as an issue (unless you beat me to it)