1

我遇到了最奇怪的错误:我有一个带有 MvxListView 的页面,这里是部分布局:

<Mvx.MvxListView
            android:id="@+id/RatingsList"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            local:MvxBind="ItemsSource Path=Dishes"
            local:MvxItemTemplate="@layout/userpagedishtemplate"
            style="@style/ToolBarImage"
            android:background="#ffffffff" />

当相应的 ViewModel 被加载时,我收到以下错误:

[MvxBind]  24.32 Unable to bind: source property source not found Cirrious.MvvmCross.Binding.Parse.PropertyPath.PropertyTokens.MvxPropertyNamePropertyToken on RestaurantPageViewModel

属性 Dishes 存在于视图模型中:

List<DishViewModel> _dishes = new List<DishViewModel>();    
    List<DishViewModel> Dishes
    {
        get
        {
            return _dishes;
        }
        set
        {
            _dishes = value;
            RaisePropertyChanged (() => Dishes);
        }
    }

我有一个用项目填充列表的方法:

private void LoadDishesFromWeb()
    {
        List<Dish> dishes = CommunicationManager.Restaurnats.GetDishListForRestaurnat (Restaurant.ID);
        foreach (var item in dishes)
        {
            Dishes.Add (new DishViewModel (item));
        }
    }

我有相同的逻辑在我的应用程序的不同视图中工作,但类型不同

有任何想法吗?

4

1 回答 1

3

块:

List<DishViewModel> Dishes 
{
    get
    {
        return _dishes;
    }
    set
    {
        _dishes = value;
        RaisePropertyChanged (() => Dishes);
    }
}

产生一个privateDishes 属性 - 尝试public在它前面添加一个单词

于 2013-08-06T00:04:25.400 回答