title: Binding: Property not found. MVVM
body: <p>I am trying to bind properties of views in the view page to a class that I have in a carpet called ViewModel, and then from an instance of another class called calculator (a model) in a carpet called Model I am trying to access to properties contained there, the problem is that it does not seem to work; in the output section, I get the following message: <strong>Binding: 'N2' property not found on 'XamForms.ViewModel.MainPageViewModel'</strong>. Where N2 is a property of the Model class "calculator".
  I will explain it with more details in the code:</p>
  
  <p>MainPage.xaml code:</p>
  
  <pre><code>&lt;Entry
      x:Name="n1"
      Text="{Binding calculator.N1}"
  &gt;&lt;/Entry&gt;
  &lt;Entry
      x:Name="n2"
      Text="{Binding calculator.N2}"
  &gt;&lt;/Entry&gt;
  &lt;Button
      BackgroundColor="LimeGreen"
      Command="{Binding Operations}"
  &gt;&lt;/Button&gt;
  </code></pre>
  
  <p>The binding to Operations works, since it is in the ViewModelPage and not in the calculator (model) one, as you will see.</p>
  
  <p>MainPage.xaml.cs code:</p>
  
  <pre><code>public MainPage()
  {
      MainPageViewModel mainPageViewModel = new MainPageViewModel();
      this.BindingContext = mainPageViewModel;
  }
  </code></pre>
  
  <p>MainPageViewModel code:</p>
  
  <pre><code>class MainPageViewModel
  {
      public Command Operations { get; set; }
      public Calculator calculator;
      public MainPageViewModel()
      {
          Operations = new Command(DoOperations);
          calculator = new Calculator();
      }
  
      private void DoOperations()
      {
          calculator.Division = calculator.N1 / calculator.N2;
          //Here is where I get the message, N1 and N2 are null, but they should have the values that I 
          //inserted on the entry, the binding to Division is also incorrect.
      }
  }
  </code></pre>
  
  <p>Calculator (Model) code:</p>
  
  <pre><code>class Calculator : INotifyPropertyChanged
  {
  
  private decimal n1;
  public decimal N1
  {
      get
      {
          return n1;
      }
      set
      {
          n1 = Convert.ToDecimal(value);
      }
  }
  
  private decimal n2;
  public decimal N2
  {
      get
      {
          return n2;
      }
      set
      {
          n2 = Convert.ToDecimal(value);
      }
  }
  
  private decimal division;
  public decimal Division
  {
      get
      {
          return division;
      }
      set
      {
          division= Convert.ToDecimal(value);
      }
  }
  
  public event PropertyChangedEventHandler PropertyChanged;
  
  protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
  {
       PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  }
  </code></pre>
  
  <p>I am studying Xamarin Forms and MVVM so it is probably an easy mistake, but I can't find it and all the related solutions that I have found are too complex for my actual level so I can't extrapolate them.
  If you need more information I will give it as soon as I see it, thanks for your time, have a good day.</p>