title: Implementing INotifyPropertyChanged for nested properties
body: <p>I have a Person class:</p>
  
  <pre><code>public class Person : INotifyPropertyChanged
  {
       private string _name;
       public string Name{
       get { return _name; }
       set {
             if ( _name != value ) {
               _name = value;
               OnPropertyChanged( "Name" );
             }
       }
  
       private Address _primaryAddress;
       public Address PrimaryAddress {
       get { return _primaryAddress; }
       set {
             if ( _primaryAddress != value ) {
               _primaryAddress = value;
               OnPropertyChanged( "PrimaryAddress" );
             }
       }
  
       //OnPropertyChanged code goes here
  }
  </code></pre>
  
  <p>I have an Address class:</p>
  
  <pre><code>public class Address : INotifyPropertyChanged
  {
       private string _streetone;
       public string StreetOne{
       get { return _streetone; }
       set {
             if ( _streetone != value ) {
               _streetone = value;
               OnPropertyChanged( "StreetOne" );
             }
       }
  
       //Other fields here
  
       //OnPropertyChanged code goes here
  }
  </code></pre>
  
  <p>I have a ViewModel:</p>
  
  <pre><code>public class MyViewModel
  {
     //constructor and other stuff here
  
       private Person _person;
       public Person Person{
       get { return _person; }
       set {
             if ( _person != value ) {
               _person = value;
               OnPropertyChanged( "Person" );
             }
       }
  
  }
  </code></pre>
  
  <p>I have a View which has the following lines:</p>
  
  <pre><code>&lt;TextBox  Text="{Binding Person.Name, Mode=TwoWay,   
      UpdateSourceTrigger=PropertyChanged /&gt;
  
  &lt;TextBox  Text="{Binding Person.Address.StreetOne, Mode=TwoWay,   
      UpdateSourceTrigger=PropertyChanged /&gt;
  </code></pre>
  
  <p>Both values show up in the text box ok when the view loads.</p>
  
  <p>Changes to the first text box will fire <code>OnPropertyChanged( "Person" )</code> in MyViewModel. Great.</p>
  
  <p>Changes to the second text box <code>("Person.Address.StreetOne")</code> does NOT fire <code>OnPropertyChanged( "Person" )</code> inside MyViewModel.  Meaning it doesn't call the Person object's SET method. Not great. Interestingly the SET method of StreetOne inside the Address class is called. </p>
  
  <p>How do I get the SET method of the Person object inside the ViewModel to be called when <code>Person.Address.StreetOne</code> is changed???</p>
  
  <p>Do I need to flatten my data so SteetOne is inside Person and not Address??</p>
  
  <p>Thanks! </p>