I have an ObservableCollection of items that is bound to a list control in my view.
I have a situation where I need to add a chunk of values to the star
This answer didn't show me the new entries in a DataGrid. This OnCollectionChanged works for me:
public class SilentObservableCollection : ObservableCollection
{
public void AddRange(IEnumerable enumerable)
{
CheckReentrancy();
int startIndex = Count;
foreach (var item in enumerable)
Items.Add(item);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, new List(enumerable), startIndex));
OnPropertyChanged(new PropertyChangedEventArgs("Count"));
OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
}
}