title: Silverlight nested RadGridView SelectedItem DataContext
body: <p>I'm developing a Silverlight 4 app and am using the 2010 Q1 release 1 RadGridView.  I'm developing this app using the MVVM pattern and trying to keep my codebehind to a minimum.</p>
  
  <p>On my View I have a RadGridView and this binds to a property on my ViewModel.  I am setting a property via the <code>SelectedItem</code>.  I have a nested RadGridView and I want to set a property on my ViewModel to the <code>SelectedItem</code> but I cannot.  I think the DataContext of my nested grid is the element in the parent's bound collection, rather than my ViewModel.  I can easily use codebehind to set my ViewModel property from the <code>SelectionChanged</code> event on the nested grid, but I'd rather not do this.  I have tried to use my viewModelName in the ElementName in my nested grid to specify that for <code>SelectedItem</code>, the ViewModel is the DataContext, but I cannot get this to work.  Any ideas?</p>
  
  <p>Here is my Xaml:</p>
  
  <pre><code>&lt;grid:RadGridView  
                      x:Name="master" 
                      ItemsSource="{Binding EntityClassList, Mode=TwoWay}" 
                      SelectedItem="{Binding SelectedEntityClass, Mode=TwoWay}" 
                      AutoGenerateColumns="False" 
                      &gt; 
  
                  &lt;grid:RadGridView.Columns&gt; 
                      &lt;grid:GridViewSelectColumn&gt;&lt;/grid:GridViewSelectColumn&gt; 
                      &lt;grid:GridViewDataColumn DataMemberBinding="{Binding Description}" Header="Description"/. 
                  &lt;/grid:RadGridView.Columns&gt; 
  
                  &lt;grid:RadGridView.RowDetailsTemplate&gt; 
                      &lt;DataTemplate&gt; 
                          &lt;grid:RadGridView 
                              x:Name="child" 
                              ItemsSource="{Binding EntityDetails, Mode=TwoWay}" 
                            /* Note: SelectedItem here is not setting my property in my ViewModel*/
                              SelectedItem="{Binding DataContext.SelectedEntityDetail, ElementName='RequestView', Mode=TwoWay}" 
                              AutoGenerateColumns="False" 
                              &gt; 
                                  &lt;grid:RadGridView.Columns&gt; 
                                      &lt;grid:GridViewSelectColumn&gt;&lt;/grid:GridViewSelectColumn&gt; 
                                      &lt;grid:GridViewDataColumn DataMemberBinding="{Binding ServiceItem}" Header="Service Item" /&gt; 
                                      &lt;grid:GridViewDataColumn DataMemberBinding="{Binding Comment}" Header="Comments" /&gt; 
                                  &lt;/grid:RadGridView.Columns&gt; 
                          &lt;/grid:RadGridView&gt; 
                      &lt;/DataTemplate&gt; 
                  &lt;/grid:RadGridView.RowDetailsTemplate&gt; 
  
              &lt;/grid:RadGridView&gt; 
  </code></pre>