title: Select the row index in datagrid (wpf)
body: <p>how Select the row index in datagrid ?</p>
  
  <blockquote>
    <p>The event SelectionChanged</p>
  </blockquote>
  
  <p>The following code does not work :</p>
  
  <pre><code>        private DataGridRow dgr = new DataGridRow();
  
      private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
      {
  
          this.dgr = this.dataGrid.ItemContainerGenerator.ContainerFromItem(this.dataGrid.SelectedItem) as DataGridRow;
          MessageBox.Show(this.dgr.GetIndex().ToString());
  
      }
  </code></pre>