title: WPF MVVM ErrorCode: CS1061
body: <p><a href="https://i.stack.imgur.com/MVtcR.png" rel="nofollow noreferrer">- the red markups are for Inputs(xAxis and yAxis)
   - after i press the button (Calculate), the inputs should be calculated.
   - then outputed at the blue markup(texbox called Output)</a></p>
  
  <p>After i made some kata with element binding, i just wanted to
     start MVVM property binding.</p>
  
  <p>For some reason i get a <code>ErrorCode: CS1061</code></p>
  
  <blockquote>
    <p>Error CS1061  <code>MainWindow</code> does not contain a definition for
    <code>CalculateClick</code> and no extension method <code>CalculateClick</code> accepting a
    first argument of type <code>MainWindow</code> could be found (are you missing a
    using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>the weird part of this is when i use the resharper eventhandler on my <code>MainWindow.xml</code> at my button it creates a event in my <code>MainWindow.cs</code>.
  But it didnt before. the events were autocreated in my <code>ViewModel.cs</code></p>
  
  <p>im not sure what causes this error
  ty in advance when somone could help me, i have already been sitting on this kata for more then 8 hours.</p>
  
  <p>Heres my <code>MainWindow.xml</code>:</p>
  
  <pre><code>&lt;Window x:Class="Coordinates.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:Coordinates"
      mc:Ignorable="d"
      Title="MainWindow" Height="250" Width="525"&gt;
  &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition/&gt;
              &lt;ColumnDefinition/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Label Grid.Row="0" Grid.Column="0" Content="Insert X-Coordiante"/&gt;
          &lt;Label Grid.Row="0" Grid.Column="1" Content="Insert Y-Coordinate"/&gt;
          &lt;TextBox Grid.Row="1" Grid.Column="0" Name="TxtXaxis" Text="{Binding Xaxis}"/&gt;
          &lt;TextBox Grid.Row="1" Grid.Column="1" Name="TxtYaxis" Text="{Binding Xaxis}"/&gt;
          &lt;TextBox Grid.Row="2" Grid.Column="0" Text="{Binding Output}"/&gt;
          &lt;Button  Grid.Row="2" Grid.Column="1" Name="Calculate" Click="CalculateClick"&gt;Calculate&lt;/Button&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is my <code>MainWinow.xml.cs</code>:</p>
  
  <pre><code>    using System.Windows;
      namespace Coordinates
      {
      /// &lt;summary&gt;
      /// Interaction logic for MainWindow.xaml
      /// &lt;/summary&gt;
      public partial class MainWindow : Window
      {
          public MainWindow()
          {
              InitializeComponent();
              this.InitializeComponent();
              this.DataContext = new ViewModel();
          }
      }
  }
  </code></pre>
  
  <p>This is my <code>ViewModel.cs</code>:</p>
  
  <pre><code>using System;
  using System.ComponentModel;
  using System.Runtime.CompilerServices;
  using System.Windows;
  
  namespace Coordinates
  {
      public class ViewModel : INotifyPropertyChanged
      {
          #region Inputs
          private double _xaxis;
          public double Xaxis
          {
              get =&gt; this._xaxis;
              set
              {
                  if (value == this._xaxis)
                  {
                      return;
                  }
                  this._xaxis = value;
                  this.OnPropertyChanged();
              }
          }
  
          private double _yaxis;
          public double Yaxis
          {
              get =&gt; this._yaxis;
              set
              {
                  if (value == this._yaxis)
                  {
                      return;
                  }
                  this._yaxis = value;
                  this.OnPropertyChanged();
              }
          }
          #endregion
  
          public void CalculateClick(object sender, RoutedEventArgs e)
          {
              Output = Math.Sqrt(Math.Pow(Xaxis,2)+Math.Pow(Yaxis,2));
          }
  
          private double _output;
          public double Output
          {
              get =&gt; this._output;
              set
              {
                  if (value == this._output)
                  {
                      return;
                  }
                  this._output = value;
                  this.OnPropertyChanged();
              }
          }
  
          public event PropertyChangedEventHandler PropertyChanged;
          private  void OnPropertyChanged([CallerMemberName] string propertyName = null)
          {
              this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
          }
  
      }
  }
  </code></pre>
  
  <p>EDIT: this was missing in CalculateClick in my viewmodel: 
  Output = Math.Sqrt(Math.Pow(Xaxis,2)+Math.Pow(Yaxis,2));</p>