title: Binding one control to another's DataContext
body: <p>I bind my wpf window to app layer class (WindowVM.cs) using <code>DataContext</code> in Window.xaml.cs constructor (<code>DataContext = WindowVM</code>). But, one control (<code>btnAdd</code>) I want to bind to Window.xaml.cs property. So in Window.xaml.cs constructor I add <code>this.btnAdd.DataContext</code>.   This is Window.xaml.cs constructor and property to which I want bind <code>Button</code> <code>btnAdd</code>:</p>
  
  <pre><code>    public Window()
      {
          InitializeComponent();
          DataContext = WindowVM;
          this.btnAdd.DataContext = this;
      }
  
      public RelayCommand Add
      {
          get
          {
              return _add == null ? _add= new RelayCommand(AddPP, CanAddPP) : _add;
          }
          set
          {
              OnPropertyChanged("Add");
          }
      }
  </code></pre>
  
  <p>Xaml looks like this (class PP is WindowVM property):</p>
  
  <pre><code>&lt;TextBox Name="txtName" Text="{Binding PP.Name, ValidatesOnDataErrors=true, UpdateSourceTrigger=PropertyChanged}" /&gt;
  &lt;TextBox Name="txtSurname" Text="{Binding PP.Surname, ValidatesOnDataErrors=true, UpdateSourceTrigger=PropertyChanged}" /&gt;
  &lt;Button Command="{Binding Add}" Content="Add" ... /&gt;
  </code></pre>
  
  <p>And - everything works, but console output this:</p>
  
  <pre><code>BindingExpression path error: 'Add' property not found on 'object' ''WindowVM'...
  </code></pre>
  
  <p>In next calls there isn't any console output error for property Add.</p>
  
  <p>Now I am a little bit confused because of this error. Is this error because of first <code>DataContext</code> (to WindowVM), because there isn't property Add, but with line <code>this.btnAdd.DataContext</code> property Add is found and it's the reason that it works?</p>