title: Pass object from parent view to sub view in MVVM
body: <p>I am currently trying to get into WPF and MVVM, but I recently ran into a problem I don't know how to solve. I am new to this, so if something is not as it should be, please tell me.</p>
  
  <p>I have a ParentView with its ParentViewModel. The ParentView holds two views SubViewA and SubViewB which both have their own ViewModels. This is my ParentView.xaml:</p>
  
  <pre><code>&lt;local:ViewBase.DataContext&gt;
      &lt;local:ParentViewModel x:Name="Model" /&gt;
  &lt;/local:ViewBase.DataContext&gt;
  
  &lt;Grid&gt;
      &lt;local:SubViewA Visibility="{Binding ElementName=Model, Path=SubViewAVisibility}" /&gt;
      &lt;local:SubViewB Visibility="{Binding ElementName=Model, Path=SubViewBVisibility}" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>What I want to do: SubViewModelB has a property that is binded to SubViewB. I want to change that property when a certain event occurs in the ParentViewModel. I suppose this should be done by binding the property in SubViewModelB to a property in ParentViewModel, but I'm not really sure how? I tried something like the following in the ParentView.xaml:</p>
  
  <pre><code>&lt;local:SubViewB Visibility="{Binding ElementName=Model, Path=SubViewBVisibility}" SomeProperty="{Binding ElementName=Model, Path=WhatIWantThePropertyToBe}" /&gt;
  </code></pre>
  
  <p>but that got me nowhere. 
  So how do I solve this? I know I could do it via messaging in the MVVM light toolkit, but that seems kind of inappropiate for what I am trying to do. Any suggestions?</p>
  
  <p>Thanks</p>