I am trying to handle the addition of new rows to a DataGrid by providing the user with an "Add" button. This calls the following simple code, which is intended to add a new row to the ItemSource, Select it, and then BeginEdit on it:
ViewModel.AddReportDue();
ReportsDueGrid.ScrollItemIntoView(ViewModel.SelectedReportDue);
ReportsDueGrid.SelectItem(ViewModel.SelectedReportDue);
ReportsDueGrid.BeginEdit(ReportsDueGrid.SelectedItem);
This works up to a point and I have ensured via the debugger that the SelectedItem in the last statement is indeed the row I have just added, but the BeginEdit always starts at the second row of the grid (see image). I have also tried to BeginEdit on the first item in the underlying collection, again with the same result. Does anyone know of a way of forcing the BeginEdit to target the correct row after the new row is added?