I have a DataGrid
where the SelectedItem
is bound to a VM Selected property. I have a search control that will do a find and the SelectedItem
You need to give the newly selected row logical focus. After selecting the new item try replacing your SetFocus
call with this:
var selectedRow = (DataGridRow)dataGrid1.ItemContainerGenerator.ContainerFromIndex(dataGrid1.SelectedIndex);
FocusManager.SetIsFocusScope(selectedRow, true);
FocusManager.SetFocusedElement(selectedRow, selectedRow);