private void CreatePlantList() { ObservableCollection <PlantVariety> list = new ObservableCollection <PlantVariety>(); List <PlantVariety> list1 = new List <PlantVariety>(); list1 = context.PlantVariety.Local.ToList(); if (checkBoxAll.IsChecked != true) { if (checkGenus.IsChecked == true) { list1 = list1.Where(x => x.Genus == SelectedGenus).Select(x => x).ToList(); } if (checkLifeForm.IsChecked == true) { list1 = list1.Where(x => x.LifeForm == SelectedLifeForm).Select(x => x).ToList(); } } if (textBoxSearch.Text != "") { list1 = list1.Where(x => x.FullName.ToLower().Contains(textBoxSearch.Text.ToLower()) == true).Select(x => x).ToList(); } PlantList.Clear(); foreach (var item in list1) { PlantList.Add(item); } }
public void ClearLogic() { PlantList.Clear(); SetAsEmptySelection(); }