Are you able to replicate this issue on a smaller scale?
Unfortunately no.
Do you refresh the DataGridCollectionView when you are removing items from the ObservableCollection?
No, the grid is not refreshed manually after removing items. The Datagrid seems to update everything (grouping, etc.) itself, thanks to INotifyCollectionChanged.
Thanks for your help.
Here is the stack trace :
Une exception de type 'System.NullReferenceException' a été levée : Object reference not set to an instance of an object.
at Xceed.Wpf.DataGrid.DataGridControl.ClearContainerForItemOverride(DependencyObject element, Object item)
at Xceed.Wpf.DataGrid.CustomItemContainerGenerator.RemoveContainer(DependencyObject container, Object dataItem)
at Xceed.Wpf.DataGrid.CustomItemContainerGenerator.RemoveAllGeneratedItems(Boolean itemsSourceChanged)
at Xceed.Wpf.DataGrid.CustomItemContainerGenerator.HandleGlobalItemsReset(Boolean itemsSourceChanged)
at Xceed.Wpf.DataGrid.CustomItemContainerGenerator.OnItemsChanged(Object sender, NotifyCollectionChangedEventArgs e)
at Xceed.Wpf.DataGrid.CustomItemContainerGenerator.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
at System.Windows.Controls.ItemCollection.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
at Xceed.Wpf.DataGrid.DataGridCollectionViewBase.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Xceed.Wpf.DataGrid.DataGridCollectionView.ForceRefresh(Boolean sendResetNotification, Boolean initialLoad, Boolean setCurrentToFirstOnInitialLoad)
at Xceed.Wpf.DataGrid.DataGridCollectionView.RemoveSourceItem(Int32 startIndex, Int32 count)
at Xceed.Wpf.DataGrid.DataGridCollectionView.ExecuteSourceItemOperation(DeferredOperation deferredOperation, Boolean& refreshForced)
at Xceed.Wpf.DataGrid.DataGridCollectionViewBase.ExecuteOrQueueSourceItemOperation(DeferredOperation deferredOperation)
at Xceed.Wpf.DataGrid.DataGridCollectionViewBase.NotifyCollectionChanged_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at Xceed.Wpf.DataGrid.DataGridCollectionViewBase.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)