有没有人使用过MvxAutoCompleteTextView?在选择建议的项目时,它会以下面的堆栈跟踪结束:
02-11 22:12:46.768 I/MonoDroid( 9400): UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: Argument is out of range.
02-11 22:12:46.768 I/MonoDroid( 9400): Parameter name: index
mvx:Diagnostic: 64.61 Wait finished with 0 items for aydi
02-11 22:12:46.768 I/MonoDroid( 9400): at System.Collections.Generic.List`1<pocketseller.core.Models.Adress>.get_Item (int) <0x0007c>
02-11 22:12:46.768 I/MonoDroid( 9400): at System.Collections.ObjectModel.Collection`1<pocketseller.core.Models.Adress>.System.Collections.IList.get_Item (int) <0x00083>
02-11 22:12:46.768 I/MonoDroid( 9400): at Cirrious.MvvmCross.Binding.ExtensionMethods.MvxEnumerableExtensions.ElementAt (System.Collections.IEnumerable,int) <IL 0x00011, 0x001df>
02-11 22:12:46.768 I/MonoDroid( 9400): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.GetRawItem (int) <IL 0x00007, 0x0004f>
02-11 22:12:46.768 I/MonoDroid( 9400): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAutoCompleteTextView.OnItemClick (int) <IL 0x00007, 0x00077>
02-11 22:12:46.768 I/MonoDroid( 9400): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAutoCompleteTextView.OnItemClick (object,Android.Widget.AdapterView/ItemClickEventArgs) <IL 0x00007, 0x00087>
02-11 22:12:46.768 I/MonoDroid( 9400): at (wrapper delegate-invoke) System.EventHandler`1<Android.Widget.AdapterView/ItemClickEventArgs>.invoke_void__this___object_TEventArgs (object,Android.Widget.AdapterView/ItemClickEventArgs) <0x00067>
02-11 22:12:46.768 I/MonoDroid( 9400): at Android.Widget.AdapterView/IOnItemClickListenerImplementor.OnItemClick (Android.Widget.AdapterView,Android.Views.View,int,long) [0x0000d] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.2-branch/4b53fbd0/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.Widget.AdapterView.cs:253
02-11 22:12:46.768 I/MonoDroid( 9400): at Android.Widget.AdapterView/IOnItemClickListenerInvoker.n_OnItemClick_Landroid_widget_AdapterView_Landroid_view_View_IJ (intptr,intptr,intptr,intptr,int,long) [0x00019] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.2-branch/4b53fbd0/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.Widget.AdapterView.cs:186
02-11 22:12:46.768 I/MonoDroid( 9400): at (wrapper dynamic-method) object.989332de-95ff-4c95-b689-646344efcc6a (intptr,intptr,intptr,intptr,int,long) <IL 0x00029, 0x0009b>
Droid项目:配置MvxAutoCompleteTextView的xaml文件是:
<?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/pocketseller.droid"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<MvxAutoCompleteTextView
android:id="@+id/selectionarticlesearchbox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
local:MvxItemTemplate="@layout/selectionarticleitem"
local:MvxBind="Text SearchKey, Mode=TwoWay; ItemsSource ListAddresses; PartialText LabelTitle; SelectedObject Address" />
</LinearLayout>
核心项目ViewModel:Binded SearchKey
private string _searchKey;
public string SearchKey { get { return _searchKey; } set { _searchKey = value; RaisePropertyChanged(() => SearchKey); SearchNow(); } }
核心项目ViewModel:Binded ListAddresses是:
private List<Adress> _listAddresses;
public List<Adress> ListAddresses { get { return _listAddresses; } set { _listAddresses = value; RaisePropertyChanged(() => ListAddresses); } }
Core Project ViewModel:分配给Address属性的选定对象:
public Adress Address
{
get { return DocumentService.Document.Adress; }
set
{
RaisePropertyChanged(() => Address);
DocumentService.Document.Adress = value;
Messenger.Publish(new DocumentMessage(this, EDocumentAction.ShowDocumentOrder));
}
}
希望我的问题是可以理解的,如果不是,请留下一个问题,我会尽力完成这个问题,谢谢!
P.S。这闻起来似乎是一个错误似乎MvxAdapter中的_itemsSource没有正确填充(?)