当我改变MainMenuViewModel在Tutorial.Core使用词典是这样的:
'公共字典项{获得; 组; }公共的ICommand ShowItemCommand {{返回新MvxRelayCommand>((类型)=> DoShowItem(type.Value)); }}
public void DoShowItem(Type itemType)
{
this.RequestNavigate(itemType);
}
public MainMenuViewModel()
{
Items = new Dictionary<string, Type>()
{
{"SimpleTextProperty", typeof(Lessons.SimpleTextPropertyViewModel)},
{"PullToRefresh", typeof(Lessons.PullToRefreshViewModel)},
{"Tip", typeof(Lessons.TipViewModel)},
{"Composite",typeof(Lessons.CompositeViewModel)},
{"Location",typeof(Lessons.LocationViewModel)}
};
}`
样品正按预期在WP7,但MonoDroid的我得到一个错误::“MvxBind:错误:2,71问题从项目到绑定的ItemsSource执行过程中看到的 - 问题的ArgumentException:未能参数转换”,因为我觉得KeyValuePair关键财产造成的问题:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/Tutorial.UI.Droid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:orientation="vertical">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="View Model:"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
local:MvxBind="{'Text':{'Path':'Key'}}"
/>
</LinearLayout>
在此先感谢您的帮助。