WPF DataGrid add a new row if we press tab on last column of last row. But after adding the new row, the focus is moved to top row of the grid. How can we make sure that the focus is moved to the first column of new row?
Asked
Active
Viewed 1,895 times
1 Answers
-1
You could try something like
this.SelectRowCell(this.Items.Count - 1, 0);
But I'm not sure if that will set the focus too. If not then try the following:
DataGridCell cell = this.GetCell(this.Items.Count - 1, 0);
if (cell != null)
{
cell.Focus();
}

Sam
- 462
- 3
- 9