System.Windows.Data.ListCollectionView.AddToFiltered C# (CSharp) Method

AddToFiltered() private method

private AddToFiltered ( object item, bool sorted ) : bool
item object
sorted bool
return bool
		bool AddToFiltered (object item, bool sorted)
		{
			// If we are not adding a new item and we have a filter, see if the item passes the filter
			if (CurrentAddItem == null && Filter != null)
				if (!Filter (item))
					return false;

			// Only do a sorted insert if we are not adding a new item
			if (CurrentAddItem == null && sorted && SortDescriptions.Count > 0) {
				int index = filteredList.BinarySearch (item, new PropertyComparer (SortDescriptions));
				if (index < 0)
					index = ~index;
				filteredList.Insert (index, item);
			} else {
				filteredList.Add (item);
			}
			return true;
		}