public override void CancelNew() { if (IsEditingItem) { throw new InvalidOperationException("Cannot CancelNew while editing an item"); } if (IsAddingNew) { if (CurrentAddItem is IEditableObject) { ((IEditableObject)CurrentAddItem).CancelEdit(); } if (Grouping) { RootGroup.RemoveItem(CurrentAddItem); } RemoveFromSourceCollection(SourceCollection.IndexOf(CurrentAddItem)); CurrentAddItem = null; IsAddingNew = false; UpdateCanAddNewAndRemove(); } }