Question

I keep getting following errormessage:

MvxBind:Warning: 15.51 Unable to bind: source property source not found 
Cirrious.MvvmCross.Binding.Parse.PropertyPath.PropertyTokens.MvxPropertyNamePropertyToken on null-object

Can't find the solution to this - since 3 hours now.

Thats the Viewmodel:

public class SettingsViewModel : MvxViewModel
{
    public SettingsViewModel()
    {

    }

    private bool testdata;
    public bool Testdata
    {
        get { return testdata; }
        set 
        {
            testdata = value; 
            RaisePropertyChanged(() => Testdata);
            //Debug.WriteLine("IN");
        }
    }
}

The View:

[Register("SettingsView")]
public class SettingsView : MvxDialogViewController
{
    public SettingsView()
        : base(pushing: true)
    {

    }

    public override void ViewDidLoad()
    {
        var bindings = this.CreateInlineBindingTarget<SettingsViewModel>();
        Root = new RootElement("Settings"){
             new Section("General")
             {
                 new BooleanElement("Testdata ON/OFF", true).Bind(bindings, t => t.Testdata)
             }
         };
    }
}

The error occurs while trying to bind de booleanelement to Testdata Property.

Any help appreciated!

Was it helpful?

Solution

The key part of the warning here seems to be on null-object

By default, MvvmCross Views find their ViewModels during ViewDidLoad() - so a solution to you current problem might be to call base.ViewDidLoad():

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

    // the rest of your Load code
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top