I have discovered a bug that occurs after I call ScrollIntoView and it throws a NullReferenceException.
Here is some background on my situation:
I have a generic user control containing a datagrid and functionality for editing, inserting and deleting items (rows in the datagrid).
I want to be able to use tab to get through controls so I have a style with Cell.IsTabStop = False.
But I want to be able to tab into the data grid. What I have done is added a handler for when the selected index property changes.
When the DataGrid.SelectedIndex property changes I focus on the cell in the first column and selected row.
When calling ScrollIntoView when this change is made, I sometimes get a null reference exception, which I geuss could be expected if the list was changing. I have guard clauses for the row and columns to ensure that they lie in the index.
But after I catch this exception, the DataGridCellsPresenter class this an exception at line 98 Debug.Assert(dataGridOwner != null, "We shouldn't be syncing properties if we don't have a valid DataGrid owner");
System.InvalidOperationException: Dispatcher processing has been suspended, but messages are still being processed.