// notification that a subgroup has become non-empty void OnSubgroupBecameNonEmpty(EmptyGroupItem groupItem, CollectionViewGroup group) { // Discard placeholder container. UnlinkContainerFromItem(groupItem, group); if (_emptyGroupItems != null) _emptyGroupItems.Remove(groupItem); // inform layout as if the group just got added if (ItemsChanged != null) { GeneratorPosition position = PositionFromIndex(ItemsInternal.IndexOf(group)); ItemsChanged(this, new ItemsChangedEventArgs(NotifyCollectionChangedAction.Add, position, 1, 0)); } }
// create an empty-group placeholder item void AddEmptyGroupItem(CollectionViewGroup group) { EmptyGroupItem emptyGroupItem = new EmptyGroupItem(); LinkContainerToItem(emptyGroupItem, group); emptyGroupItem.SetGenerator(new ItemContainerGenerator(this, emptyGroupItem)); // add it to the list of placeholder items (this keeps it from being GC'd) if (_emptyGroupItems == null) _emptyGroupItems = new ArrayList(); _emptyGroupItems.Add(emptyGroupItem); }