title: MVVM Binding to properties of an observable property
body: <p>I am trying to figure out on how to trigger the PropertyChangedEvent when the middle layer of my binding changes. I will start with an example here:</p>
  
  <pre><code>public class MainViewModel :NotificationObject // Main DataContext
  { 
     public SubViewModel SubVM{get; {_subVM = value; RaisePropertyChanged("SubVM");}}  // observable property
     public void DoChangeSubVM()
     {
        SubVM = new SubViewModel(); // doing this will not update the egControl
     }
  }
  
  public class SubViewModel : NotificationObject
  {
     public Sub2ViewModel Sub2VM {get; set{_sub2VM = value; RaisePropertyChanged("Sub2VM");}} // observable property
  }
  
  public class Sub2ViewModel : NotificationObject
  {
     public int SomeProp {get; set {_someProp = value; RaisePropertyChanged("SomeProp");} // observable property
  }
  </code></pre>
  
  <p>in the XAML:</p>
  
  <pre><code>&lt;EgControl name="egControl" Content={Binding SubVM.Sub2VM.SomeProp} /&gt;
  </code></pre>
  
  <p>Now if I change the Sub2VM Property the egControl doesn't automagically get updated with the SomeProp value of the new Sub2VM instance. How does someone go about achieving this, with out manually having to raise all the Sub2ViewModel propertychanged events from Sub2VM property setter?</p>
  
  <p>Using: Prism .NET 4.0</p>