title: How do I display two tables in a data grid/tree view showing columns for both the parent and child tables (when child expanded)
body: <p>I'm trying to use a TreeView/DataGrid to display some data. I need to display columns for the top level items, but also display a header for the expanded level.</p>
  
  <p>I have a dataset with two tables, e.g. Orders and Items, items has a foreign key to Orders.</p>
  
  <p><img src="https://i.stack.imgur.com/3Z8uW.jpg" alt="Dataset from Visual Studio"></p>
  
  <p>I'm trying to bind the dataset to the datagrid/tree view so that I show the list of orders.</p>
  
  <p>The WinFrom DataGrid can show multiple tables from the DataSet:</p>
  
  <p><img src="https://i.stack.imgur.com/4uPBd.jpg" alt="Data Grid Example"></p>
  
  <p>Which I set with:</p>
  
  <pre><code>dataGrid.DataSource = dataSet;
  dataGrid.DataMember = "Orders";
  </code></pre>
  
  <p>Clicking the [+] expands the row to show the link:</p>
  
  <p><img src="https://i.stack.imgur.com/Sk8mH.jpg" alt="Expanded DataGrid"></p>
  
  <p>Following that link brings up the Items Table:</p>
  
  <p><img src="https://i.stack.imgur.com/hZK8t.jpg" alt="DataGrid Items shown"></p>
  
  <p>What I'm after is a mix of both but in WPF:</p>
  
  <p><img src="https://i.stack.imgur.com/hfixy.jpg" alt="Merged"></p>
  
  <p>I've used a dataset for this example but I can massage my data into collections etc that WPF can use to display the data in the way I'm trying to achieve.</p>
  
  <p>I've looked at the <a href="http://blogs.msdn.com/b/atc_avalon_team/archive/2006/03/01/541206.aspx" rel="nofollow noreferrer">TreeListView</a> which gives me the top level item headers, but I'm scratching my head trying to get the expanded items header to be shown. Could someone point me in the right direction, thanks.</p>
  
  <p><strong>Update</strong> I've come back to looking at this issue. As per @offapps-cory's answer I tried using a ListView with expander with a listview. 1st attempt:</p>
  
  <p><img src="https://i.stack.imgur.com/ZKGlf.jpg" alt="enter image description here"></p>
  
  <p>As you can see, it expanded in the cell :) I'm thinking maybe I can throw a treeview into the mix...</p>