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