private void FilterTimetable() { TimetableCourseProject Context = new TimetableCourseProject(); TimetableDatabase = new ObservableCollection <Timetable>(Context.Timetable.ToList()); if (Timetable != null) { Timetable.Clear(); if (TimetableDatabase.Count != 0) { foreach (var obj in TimetableDatabase) { if (FilterTimetable(obj)) { Timetable.Add(obj); } } } } }