title: Binding data grid values to another data grid
body: <p>I have two datagrids. The first contains the columns:</p>
  
  <pre><code>name, price, rank, rating, groupNumber ..... and many other columns
  </code></pre>
  
  <p>And the second contains:</p>
  
  <pre><code>name, rating, groupNumber
  </code></pre>
  
  <p>Suppose I selected a row in the first datagrid and for that row <code>GroupNumber</code> was <code>6</code>, is there a way to display all the rows with groupNumer=6 using data binding in second datagrid?</p>
  
  <p>What would be the best way to do such thing?</p>
  
  <p>Right now I doing it by selecting all the rows that have the same group number as the selected row in the first grid then copying those rows to another datatable then setting it as the source of the second grid.</p>
  
  <p>Here is how i am doing it right now on row selection changed for the first grid:</p>
  
  <pre><code>int gnum = //get the selected row gnum value
  secondgrid.ItemsSource = firstgrid.Select(String.Format("gnum={0}", gnum)).CopyToDataTable().DefaultView;
  </code></pre>