title: WPF - How can I get newly inserted row data row grid
body: <p>By default my grid is empty, I am trying to get the row data that user insert to my grid , somehow after commit change, I have to idea how to get ,  I try use grid.SelectedItem , but the it always return null ,</p>
  
  <p>My XAML code as below</p>
  
  <pre><code> &lt;DataGrid x:Name="grdInfo" Height="373" VerticalAlignment="Top" DockPanel.Dock="Top" Margin="0,10,0,0" RowEditEnding="grdInfoSave" AutoGenerateColumns="False"&gt;
              &lt;DataGrid.Columns&gt;
                  &lt;DataGridTextColumn Header="No" Binding="{Binding No}" Width="50" /&gt;
                  &lt;DataGridTextColumn Header="Description" Binding="{Binding Description}" Width="*" /&gt;
                  &lt;DataGridTextColumn Header="Total" Binding="{Binding Total}" Width="120" /&gt;
              &lt;/DataGrid.Columns&gt;
   &lt;/DataGrid&gt;
  </code></pre>
  
  <p>My Cs Code for committing edit is as below</p>
  
  <pre><code> private void grdInfoSave(object sender, DataGridRowEditEndingEventArgs e )
   {
        if (e.EditAction == DataGridEditAction.Commit)
        {
          //Try to get the user inserted value and process it
          DataRowView row = (DataRowView)grdInfo.SelectedItem;
          int No = Convert.ToInt32(row["No"]);
        }
   }
  </code></pre>
  
  <p>Code for generate table</p>
  
  <pre><code> private void genTable()
   {
          DataTable dtInfo = new DataTable(); 
  
          dtInfo.Columns.Add(new DataColumn("No", Type.GetType("System.Int32")));
          dtInfo.Columns.Add(new DataColumn("Description", Type.GetType("System.String")));
          dtInfo.Columns.Add(new DataColumn("Total", Type.GetType("System.String")));
  
          grdInfo.ItemsSource = dtInfo.DefaultView;  
   }
  </code></pre>
  
  <p>What I need is when user enter 1 for <code>No</code> column , Apple for Description , 200 for total , I wish to get the entire row data.</p>