Focus problem of DataGrid

Feb 16, 2009 at 9:56 AM
Problem 1: The focus does not move back to the cell that has focus before focus is moved out.
Following is the operation steps:
1). One DataGridCell is selected and has the keyboard focus.
2). Use mouse to change keyboard input focus to one control at the above (outside) of DataGrid.
3). Press Tab key to change focus back to DataGrid.
4). Focus is move to the first cell of the first visible row.
    The expected result is move back to the cell that has focus before focus is moved to outside of DataGrid.

Problem 2: The line that is selected and has focus becomes invisible when focus is moved back.
Prerequisite: The DataGrid has many rows, and only some of the rows can be displayed.
For example, there are 1000 rows, only 20 rows can be displayed at the same time.
1). Firstly, use vertical scroolbar to make the row No.100 be visible.
2). Then click the row to make it selected and has focus.
3). Click one control at the above side of DataGrid.
4). Press Tab key to make focus move back to DataGrid.
The expected result is that the focus moves back to the row has focus before focus is moved outside of DataGrid.
The actual result is that the visible rows is changed in the DataGrid, the row that has been selected is moved out of visible.
It seems that the first row that is ContainersGenerated is been bring into view and be displayed as the first row.
The result of this is influenced by the setting of EnableRowVirtualization.