I have a wpf datagrid with SelectionUnit set to "CellOrRowHeader" and SelectionMode set to "Extended".
<DataGrid SelectionUnit="Cell" SelectionMode="Extended" Name="myDataGrid">
CurrentCellChanged="onCurrentCellChanged"
</DataGrid>
Inside the onCurrentCellChanged I tried to change the selection to another cell:
private void onCurrentCellChanged(object sender, EventArgs e)
{
DataGridCell cell = DataGridHelper.GetCell(myDataGrid, 3, 3);
cell.IsSelected = true;
cell.Focus();
}
The GetCell is a helper function. I verified that the cell is not null, and the codes are executed. However, I only see the cell {3,3} is focused (with a black border), but not highlighted (without blue background).
The strange thing is that if I call the same code, but not inside onCurrentCellChanged event callback, the cell {3,3} got highlighted.
Anybody knows the reason ? Many thanks!