public override void Refresh() { if (IsAddingNew || IsEditingItem) { throw new InvalidOperationException("Cannot refresh while adding or editing an item"); } if (DeferLevel != 0) { return; } Groups = null; RootGroup.ClearItems(); if (ActiveList != SourceCollection) { try { IgnoreFilteredListChanges = true; filteredList.Clear(); foreach (var item in SourceCollection) { AddToFiltered(item, false); } if (SortDescriptions.Count > 0) { filteredList.Sort(new PropertyComparer(SortDescriptions)); } } finally { IgnoreFilteredListChanges = false; } if (GroupDescriptions.Count > 0 && filteredList.Count > 0) { foreach (var item in filteredList) { RootGroup.AddInSubtree(item, Culture, GroupDescriptions, false); } Groups = RootGroup.Items; } } IsEmpty = ActiveList.Count == 0; IsCurrentAfterLast = CurrentPosition == ActiveList.Count || ActiveList.Count == 0; IsCurrentBeforeFirst = CurrentPosition == -1 || ActiveList.Count == 0; int index = IndexOf(CurrentItem); if (index < 0 && CurrentPosition != -1 && !IsEmpty) { index = 0; } RaiseCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset), false); MoveCurrentTo(index, true, false); }