I am setting the SelectedItem of a DataGrid in code behind, but this does not move the focus to that row. I have tried the following:
dgEmployees.SelectedItem = emp;
dgEmployees.CurrentItem = emp;
dgEmployees.ScrollIntoView(emp);
DataGridRow dgrow = (DataGridRow)dgEmployees.ItemContainerGenerator.ContainerFromItem(emp);
dgrow.Focus();
Unfortunately this has not worked. I have Googled for over an hour trying to find an answer to this problem and so far failed - anybody have any bright ideas??