title: Pass data from code behind and ViewModel to another ViewModel
body: <p>I have a View which has 2 sub views on it and a ViewModel is assigned to each view:</p>
  
  <pre><code>ViewParent - ViewModelParent
  { 
     ViewA - ViewModelA
     ViewB - ViewModelB
  }
  </code></pre>
  
  <p>The <code>ViewParent</code> structure likes below.</p>
  
  <pre><code>&lt;StackPanel Orientation="Vertical"&gt;
      &lt;local:AView DataContext="{Binding ViewModelA, Mode=TwoWay}"&gt;&lt;/localViews:AView&gt;
  &lt;/StackPanel&gt;
  &lt;StackPanel Orientation="Vertical"&gt;
      &lt;localViews:BView DataContext="{Binding ViewModelB, Mode=TwoWay}"&gt;&lt;/localViews:BView&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now in code behind of <code>ViewA</code>, I have an event to select a row in a gridview. </p>
  
  <pre><code>  private void radGridView_SelectionChanged(object sender, SelectionChangeEventArgs e)
      {
          try
          {
              RadGridView grv = sender as RadGridView;                       
  
              if (e.AddedItems.Count &gt; 0)
              {
                 var row = grv.SelectedItem as SomeClass;
                 if(condition)
                    // Enable a button in ViewB.
  </code></pre>
  
  <p>What I want is to pass <code>row</code> to <code>ViewModelB</code>. Also, I want to enable a button in ViewB. Finally I want to pass a few integers from <code>ViewModelA</code> to <code>ViewModelB</code>.</p>
  
  <p>How to do it? I thought about constructor injection but still without clear idea.</p>