Presenting FilterList
Earlier today i decided to add ‘Filtering’ to my SortableBindingList. This resulted in writing a FilterList class. This class can be easily used as following
void textBoxFilter_KeyUp(object sender, KeyEventArgs e)
{
var filterChars = this.textBoxFilter.Text.ToLower();
this.Filter(filterChars);
}
void Filter(string filterChars)
{
var persons = (FilterList<person>)this.dataGridView1.DataSource;
persons.Filter(p => p.Firstname.ToLower().Contains(filterChars));
}
I even created a screencast to demonstrate it:
[mediaplayer src=‘http://www.timvw.be/screencasts/filterlist.wmv’ width=512 height=344]