using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; namespace WPFluent.Controls; public class TreeModelRowCollection : ObservableCollection { public void RemoveRange(int index, int count) { CheckReentrancy(); if (Items is List { } items) { items.RemoveRange(index, count); } OnReset(); } public void InsertRange(int index, IEnumerable collection) { CheckReentrancy(); if (Items is List { } items) { items.InsertRange(index, collection); } OnReset(); } /// /// /// /// private void OnReset() { OnPropertyChanged(nameof(Count)); OnPropertyChanged("Item[]"); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } private void OnPropertyChanged(string propertyName) { OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); } }