Search code examples
c#iosxamarinmvvmcross

Binding properties in MvxDialogViewController gives me a warning


I am binding a simple view property to a viewmodel in MvxDialogViewController and get the following warning: Warning: 40.44 Failed to create target binding for binding for TestString for TestString

i have the following code in ViewDidLoad of the view

   private string TestString { set; get; }

   public override void ViewDidLoad()
    {
            base.ViewDidLoad();

            var set = this.CreateBindingSet<FirstView, FirstViewModel>();
            set.Bind(this).For(p => p.TestString).To(vm => vm.TestString);
            set.Apply();
    }

and in ViewModel I have:

    private string _testString;



    public string TestString
    {
        get { return _testString; }
        set { _testString = value; RaisePropertyChanged(() => TestString); }
    }

similar works fine with MvxViewController.

I added code above to N_23 sample and still get the same warning. Also my base class for Setup is

   public class Setup : MvxTouchDialogSetup

Should this binding work for MvxViewController as well?

Thanks you

Mark


Solution

  • Binding can't access private properties.

    Try public to avoid reflection security issues.