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:

This entry was posted on Friday, November 6th, 2009 at 11:18 and is filed under C#, Windows Forms. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply