Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Failed to create target binding for to" in MvvmCross .dialog

So I'm playing around with MvvmCross and Monotouch.Dialog in iOS and I am experiencing a binding issue when I do something that is pretty trivial - and in fact done almost verbatim in one of Stuart's n+1 videos.

Given the following view:

[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)
            }
        };

    }
}

and this ViewModel:

public class FirstViewModel : MvxViewModel
{
    private string _searchString = "search string";
    public string SearchString
    {
        get
        {
            return _searchString;
        }
        set
        {
            _searchString = value; 
            RaisePropertyChanged(() => SearchString);
        }
    }

}

When navigate to this view, I get the following errors from 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 

I'm not exactly sure why the binding is failing. If I set a break point in the "Get" for SearchString, I do in fact see it getting hit. Changing the value of the Entry Element however does not trigget the "Set".

Any thoughts?

like image 484
Frank Caico Avatar asked Mar 22 '23 16:03

Frank Caico


1 Answers

Stuart's guess is correct: All I needed to do was change my Setup class to inherit from MvxTouchDialogSetup.

like image 151
Frank Caico Avatar answered Mar 25 '23 07:03

Frank Caico