Posted 15 years ago
by Phil Devaney
-
Senior Software Engineer,
Serck Controls Ltd
Version: 9.2.0512
Platform: .NET 4.0
Environment: Windows Vista (64-bit)

If I set NewRowTemplateBehavior.Template on a .NET 4.0 DataGrid (i.e. the one from System.Windows.Controls), using the template from the sample application, and bind ItemsSource to an ObservableCollection, then I get a crash if I call Clear on the source collection.
The crash is a NullReferenceException inside framework code, the last user function on the stack is OnDataGridUnloadingRow, on the line e.Row.UpdateLayout(). This only happens with the .NET 4.0 DataGrid, the one from WpfToolkit is OK.
If I remove the call to UpdateLayout then it doesn't crash, and there are no immediately obvious adverse effects. I know you aren't supporting .NET 4 just yet, so I can live with this for now.
I have emailed a sample project showing the problem to support.
The crash is a NullReferenceException inside framework code, the last user function on the stack is OnDataGridUnloadingRow, on the line e.Row.UpdateLayout(). This only happens with the .NET 4.0 DataGrid, the one from WpfToolkit is OK.
If I remove the call to UpdateLayout then it doesn't crash, and there are no immediately obvious adverse effects. I know you aren't supporting .NET 4 just yet, so I can live with this for now.
I have emailed a sample project showing the problem to support.