public void FilterBy() { var items = new List <MyFilterableItem> { new MyFilterableItem { MyString = "A", Age = 40 }, new MyFilterableItem { MyString = "B", Age = 20 }, new MyFilterableItem { MyString = "C", Age = 30 }, }; var source = new PagedSource(items, 10); var commands = new PagedSourceCommands(source); source.FilterBy <MyFilterableItem>(p => p.Age > 20); Assert.AreEqual("A", ((MyFilterableItem)source[0]).MyString); Assert.AreEqual("C", ((MyFilterableItem)source[1]).MyString); commands.ClearFilterCommand.Execute(null); Assert.AreEqual("A", ((MyFilterableItem)source[0]).MyString); Assert.AreEqual("B", ((MyFilterableItem)source[1]).MyString); Assert.AreEqual("C", ((MyFilterableItem)source[2]).MyString); }
private void Filter(string args) { if (string.IsNullOrWhiteSpace(args)) { PagedSource.ClearFilter(); } else { var age = int.Parse(args.ToString()); PagedSource.FilterBy <PersonModel>(p => p.Age > age); } }