所以我正在玩iOS中的MvvmCross和Monotouch.Dialog,当我做一些非常微不足道的事情时,我遇到了一个绑定问题 - 实际上在Stuart的n + 1视频中几乎逐字完成。
鉴于以下观点:
[Register("FirstView")]
public class FirstView : MvxDialogViewController
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
var bindings = this.CreateInlineBindingTarget<FirstViewModel>();
Root = new RootElement("Example Root")
{
new Section("Search")
{
new EntryElement("SearchString", "Search String").Bind(bindings, vm => vm.SearchString)
}
};
}
}
和这个ViewModel:
public class FirstViewModel : MvxViewModel
{
private string _searchString = "search string";
public string SearchString
{
get
{
return _searchString;
}
set
{
_searchString = value;
RaisePropertyChanged(() => SearchString);
}
}
}
导航到此视图时,我从Mvx获得以下错误:
2013-08-22 14:44:51.766 TestApp[11581:c07] MvxBind:Error: 2.02 Empty binding target passed to MvxTargetBindingFactoryRegistry
[0:] MvxBind:Error: 2.02 Empty binding target passed to MvxTargetBindingFactoryRegistry
[0:]
2013-08-22 14:44:51.869 TestApp[11581:c07] MvxBind:Warning: 2.10 Failed to create target binding for to
[0:] MvxBind:Warning: 2.10 Failed to create target binding for to
我不确定绑定失败的原因。如果我在SearchString的“获取”中设置了一个断点,我确实看到它被击中了。但是,更改Entry元素的值不会触发“Set”。
有什么想法?
答案 0 :(得分:7)