private void Students_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { switch (e.Action) { case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: var student = e.OldItems[0] as Student; // get current student Resettlements.Where(x => x.GradeBookNumber == student.GradeBookNumber) .ToList() .ForEach(r => Resettlements.Remove(r)); break; } }
private void Rooms_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { switch (e.Action) { case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: var room = e.OldItems[0] as Room; // get current room Resettlements.Where(x => x.RoomId == room.Id) .ToList() .ForEach(r => Resettlements.Remove(r)); break; } }