title: RIA Services - Getting DataContext in a List item
body: <p>I'm looking for a workaround for my RIA Services project, which has a Listbox with the Listitems as a user control defined as an ItemTemplate, like this:</p>
  
  <pre><code>&lt;ListBox x:Name="lstMain"&gt;
     &lt;ListBox.ItemTemplate&gt;
       &lt;DataTemplate&gt;
         &lt;StackPanel Orientation="Horizontal"&gt;
             &lt;foo:ListItemDetail /&gt;
         &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
    &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>The Listbox is bound to a Domain Service in the code-behind. 
  The List items are of type ListItemDetail, which has editable fields and an Update button.
  I'd like to call the Domain Service (the parent Lists's Data Context) to SaveChanges() and update the item when the button is clicked, but there is no way to get to the (original) Domain Service that populated the list.
  Is there an elegant solution for this?</p>
  
  <p>I am trying to use the Listbox tag item to store the domain context, but I am unable to get to it from a ListItem. I get the parent StackPanel, but it's parent is null.</p>
  
  <p>Thanks in advance,
  Ra</p>