After one or more of my underlying items of my DataSource has changed, I call ResetBinding( false ) on the datasource so the grid can refresh its content. From times to times, I get the following exception:
Cannot perform this operation while the generator is busy generating items
Here is the detail of the exception
System.InvalidOperationException = Cannot perform this operation while the generator is busy generating items
Message = Cannot perform this operation while the generator is busy generating items
Exception's Data
Message = Cannot perform this operation while the generator is busy generating items
(Dictionary with 0 entrie(s))
TargetSite = Void OnItemsChanged(System.Object, System.Collections.Specialized.NotifyCollectionChangedEventArgs)
Source = Xceed.Wpf.DataGrid
Stack Trace = 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.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
at Xceed.Wpf.DataGrid.DataGridCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Xceed.Wpf.DataGrid.DataGridCollectionView.ForceRefresh(Boolean sendResetNotification, Boolean initialLoad)
at Xceed.Wpf.DataGrid.DataGridCollectionView.BindingList_ListChanged(Object sender, ListChangedEventArgs e)
at Xceed.Wpf.DataGrid.DataGridCollectionView.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 Xceed.Utils.Collections.ListChangedEventManager.OnListChanged(Object sender, ListChangedEventArgs args)
at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)
at System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)
at System.Windows.Forms.BindingSource.ResetBindings(Boolean metadataChanged)
I don't know what to do to make the grid refresh correctly. It seems that the problem occurs when there is several items in the grid.
Thank you