title: Binding to ViewModel.SubClass.Property (sub-property)
body: <p>let's say i have a section on my screen where "current record" is edited.. so my view model has a class with all currently edited properties such as: </p>
  
  <pre><code>class Record { 
      public string Notes { get { return "Foo"; } set { _notes = value; Notify("Notes"); }
  }
  </code></pre>
  
  <p>and we add this class to the view model:</p>
  
  <pre><code>class AdjustsmentViewModel {
      public Record CurrentRecord { get { return new Record(); }}
  }
  </code></pre>
  
  <p>How can i bind to Notes property of CurrentRecord in my view? I tried this:</p>
  
  <pre><code>&lt;TextBox Text="{Binding CurrentRecord.Notes, Mode=TwoWay}" VerticalScrollBarVisibility="Auto" TextWrapping="WrapWithOverflow" AcceptsReturn="True"  /&gt;
  </code></pre>
  
  <p>This is not working however. I also tried setting DataContext of surrounding StackPanel:</p>
  
  <pre><code>&lt;StackPanel DataContext="{Binding CurrentRecord}"&gt;
  </code></pre>
  
  <p>After that, i tried in my TextBox {Binding Notes} and {Binding Path=Notes}, but none of these seem to work. </p>
  
  <p>Perhaps above really should work and i am messing something elsewhere? </p>
  
  <p><strong>Update</strong></p>
  
  <p>This is happening in a user control. This user control has a separate view model, from it's parent window. </p>
  
  <pre><code>this.DataContext = UnityUtil.Resolve&lt;AdjustmentsViewModel&gt;();
  </code></pre>
  
  <p>Also i am seeing a binding error: <em>'Notes' property not found on 'object' ''MainViewModel'</em> </p>
  
  <p>that view model is set on the main window. </p>
  
  <p>to verify that i have the right ViewModel bound, i just added this property directly on the viewmodel:  </p>
  
  <pre><code>public string Notes2 { get { return "Bar"; } } 
  </code></pre>
  
  <p>and corresponding textblock in the view:</p>
  
  <pre><code>&lt;TextBlock Text="{Binding Path=Notes2}" /&gt;
  </code></pre>
  
  <p>this works as expected. </p>
  
  <p><strong>Great Success</strong></p>
  
  <p>Thanks to Ryan, i was able to find the problem. It was not in the property itself, but the way CurrentRecord was being set. In my setter, i make a call to INotifyPropertyChange handler, but that had the old name of the property in it. So the view was not getting a CurrentRecord notification, so i guess Notes notification was not enough .. </p>
  
  <p>in conclusion, this notation is correct: <strong>{Binding Path=CurrentRecord.Notes}</strong></p>