void RemoveMonkey(Oven monkey) { if (Ovens.Contains(monkey)) { Ovens.Remove(monkey); } }
public OvenViewModel() { source = new List <Oven>(); CreateMonkeyCollection(); CurrentItem = Ovens.Skip(3).FirstOrDefault(); OnPropertyChanged("CurrentItem"); Position = 3; OnPropertyChanged("Position"); }
void FilterItems(string filter) { var filteredItems = source.Where(monkey => monkey.Name.ToLower().Contains(filter.ToLower())).ToList(); foreach (var monkey in source) { if (!filteredItems.Contains(monkey)) { Ovens.Remove(monkey); } else { if (!Ovens.Contains(monkey)) { Ovens.Add(monkey); } } } }