无法绑定tableview单元格"已选择"属性

时间:2014-04-09 05:21:11

标签: mvvmcross

我有一个视图模型

public class ComplectationSubItemWrapper: MvxViewModel
{
    public ComplectationSubItemWrapper ()
    {
    }

    private ComplectationSubItem _complectationSubItem;
    public ComplectationSubItem ComplectationSubItem
    { 
        get { return _complectationSubItem; }
        set { _complectationSubItem = value; RaisePropertyChanged(() => ComplectationSubItem); }
    }

    private bool _isSelected;
    public bool IsSelected
    {
        get{ return _isSelected; }
        set {
            _isSelected = value; 
            RaisePropertyChanged(() => IsSelected);
        }
    }
}

如何将IsSelected属性绑定到TableCell的Selected? 我试过了:

this.DelayBind(() => {
            var set = this.CreateBindingSet<GenericPopoverCell, ComplectationSubItemWrapper>();
            set.Bind(lblTitle).To(vm => vm.ComplectationSubItem.Title);
            set.Bind(this).For(s => s.Selected).To(vm => vm.IsSelected);
            set.Apply ();
        });

但这不起作用。似乎在绑定发生之前初始化了Selected属性。 SelectionChangedCommand不合适,因为我需要AllowMultipleSelection。

0 个答案:

没有答案