/// <summary> /// Remove an item from the direct children of a group. /// </summary> /// <param name="group">Group to remove item from</param> /// <param name="item">Item to remove</param> /// <returns>True if item could not be removed</returns> private bool RemoveFromGroupDirectly(CollectionViewGroupInternal group, object item) { int leafIndex = group.Remove(item, true); if (leafIndex >= 0) { OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, leafIndex)); return(false); } else { return(true); } }
//------------------------------------------------------ // // Private Methods // //------------------------------------------------------ /// <summary> /// Removes an empty group from the PagedCollectionView grouping /// </summary> /// <param name="group">Empty subgroup to remove</param> private static void RemoveEmptyGroup(CollectionViewGroupInternal group) { CollectionViewGroupInternal parent = group.Parent; if (parent != null) { GroupDescription groupBy = parent.GroupBy; int index = parent.ProtectedItems.IndexOf(group); // remove the subgroup unless it is one of the explicit groups if (index >= groupBy.GroupNames.Count) { parent.Remove(group, false); } } }