by Dean
During the creation of a recent demo Silverlight project, I tasked myself with creating a generic (re-useable) filter control that I could use to filter rows in a Silverlight DataGrid.
The control had to be lightweight, and work automatically with any object collection that the DataGrid was bound to – thus making it plug-and-play for any future uses.
I’ve created a great starting point with this, by designing a set of inter-operating classes that have the following key features.
- The Filter control of writtem completely in Xaml, using Xaml binding syntax (good designer supprt)
- By virtue of point 1, it is easily modified in Blend
- The filter control works by creating Lambda/Linq Expression trees to perform filtering.
- The filter control can ustilise the DescriptionAttribute for plug-and-play.
Here are a couple of screenshots:
1) No filtering