4
因此,我在iOS中玩弄MvvmCross和Monotouch.Dialog,當我做一些非常微不足道的事時,我遇到了一個綁定問題 - 事實上,幾乎逐字地在斯圖爾特的n + 1視頻之一。「無法爲MvvmCross創建目標綁定」.dialog
考慮以下幾種觀點:
[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)
}
};
}
}
這個視圖模型:
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的「Get」中設置了一個斷點,我確實看到它被擊中。但是,更改Entry元素的值不會觸發「Set」。
有什麼想法?
從「空綁定目標」中,我唯一的直接想法是你是否將設置更改爲從'MvxTouchDialogSetup'繼承? – Stuart
啊!這確實是我錯過的。問題解決了。 – Frank