title: How to find the row value of the cell clicked in a DataGrid on WPF?
body: <p><img src="https://i.stack.imgur.com/zllpr.png" alt="http://i.stack.imgur.com/zllpr.png"></p>
  
  <p>I wish to click on the end row of this data grid (in the above picture). When clicking this, I want to be able to find which row was clicked and pass the row-number over to another form. </p>
  
  <p>Here are a few attempts that I have tried: </p>
  
  <pre><code>  private void CellClicked(object sender, MouseButtonEventArgs e)
      {
          int cell = dgFake.Items.IndexOf(((DataRowView)dgFake.Items[5]).Row);
  
          xamlAllocteAudits window = new xamlAllocteAudits
          {
              DataContext = cell
          };
          window.Show();
  </code></pre>
  
  <p>This attempt stayed as a value of '-1' no matter where I clicked in the column.</p>
  
  <pre><code>private void CellClicked(object sender, MouseButtonEventArgs e)
      {
          int cell = dgFake.Items.IndexOf(dgFake.SelectedIndex);
  
          xamlAllocteAudits window = new xamlAllocteAudits
          {
              DataContext = cell
          };
          window.Show();
  </code></pre>
  
  <p>This attempt displayed a different number starting at '-1' and incremented every time I clicked a cell in the column, but even if I click the bottom cell, the first click would always be '-1', so I assume this was not the row number value. </p>