private void ApplyFilters() { List <Plan> filteredList = new List <Plan>(); foreach (Plan plan in planList) { bool included = true; if (!plan.Name.ToLower().Contains(SearchText.ToLower()) && !string.IsNullOrEmpty(searchText)) { included = false; } List <int> types = new List <int>(); if (IsFilterLanguageActive) { types.Add(PLANTYPE.LANGUAGE); } if (IsFilterSportActive) { types.Add(PLANTYPE.SPORT); } if (IsFilterFoodActive) { types.Add(PLANTYPE.FOODANDDRINK); } if (IsFilterPartyActive) { types.Add(PLANTYPE.PARTY); } if (IsFilterShoppingActive) { types.Add(PLANTYPE.SHOPPING); } if (IsFilterSpectaclesActive) { types.Add(PLANTYPE.SPECTACLES); } if (IsFilterTravelActive) { types.Add(PLANTYPE.TRAVEL); } if (types.Count > 0 && !types.Contains(plan.PlanType)) { included = false; } if (IsFilterTodayActive && plan.PlanDate.Date != DateTime.Now.Date) { included = false; } if (IsFilterWeekActive && plan.PlanDate.Date > DateTimeUtils.GetLastWeekDay()) { included = false; } if (IsFilterNearActive && DistanceHelper.GetInstance().GetDistance(plan.Longitude, plan.Latitude).Result > 15) { included = false; } if (included) { filteredList.Add(plan); } } FilteredPlanList = new ObservableCollection <Plan>(filteredList); }