I've made a few bug-fixes to my DataGridViewAutoFilter sample, which is described in Building a Drop-Down Filter List for a DataGridView Column Header Cell. It might be a week or two until the article is updated (as of December 5, 2007), but the new sample download has already been posted. The download contains C# and VB projects, plus the updated article in Word 2003 format.
Here's a summary of the fixes:
- The code that populates the drop-down list now does a case-insensitive match between the column's DataPropertyName and the data source properties. This is necessary because data-source property-access APIs are case-sensitive but DataPropertyName is case-insensitive. This caused problems with columns that are manually bound using a different casing than is used in the data source.
- The code that populates the drop-down now does a null-value check before resetting the filter. The previous version caused some issues when binding to an lBindingListView implementation that my colleague Cheryl is working on for a forthcoming whitepaper.
- The drop-down button size is now constrained by the header cell width as well as the height. Previously, the drop-down button for a very narrow column would overlap the adjacent column.
- The drop-down button painting code is no longer executed if the button is of zero size. Previously, this caused an exception, for example when using the mouse to reduce the height of the column headers row to zero.