private void MatchYearToViewSource(YearItemData yearItem) { bool itemMatchFilter = _libraryViewData.CheckYearsFilters(yearItem, EmptyYearsCheckBox.IsChecked == true); if (!itemMatchFilter) { YearsView.Items.Remove(yearItem); } }
/// <summary> /// Checks current filters on a <see cref="YearItemData"/> instance. /// </summary> /// <param name="yearItem"><see cref="YearItemData"/></param> /// <param name="checkEmpty">Filters invalid names.</param> /// <returns><c>True</c> if all filters apply; <c>False</c> otherwise.</returns> /// <exception cref="ArgumentNullException"><paramref name="yearItem"/> is <c>Null</c>.</exception> public bool CheckYearsFilters(YearItemData yearItem, bool checkEmpty) { if (yearItem == null) { throw new ArgumentNullException(nameof(yearItem)); } return(ApplyFilters(new List <YearItemData> { yearItem }, checkEmpty ).Any()); }