Error when making bind ObservableCollection<string> for a MvxListView

可紊 提交于 2019-12-11 07:50:56

问题


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)



来源:https://stackoverflow.com/questions/17729282/error-when-making-bind-observablecollectionstring-for-a-mvxlistview

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