DevExpress automatically generates ListView and DetailView views for you. List views are great: they provide paging and sorting out of the box. But what about filtering? How can we implement complex, multi-faceted, Excel-style filtering?
The answer is surprisingly easy: simply toggle the
ShowAutoFilter property on the ListView.
To set this:
- Double-click on your .xafml file to load up the model editor
- Uncheck the Views node (see screenshot)
- Find the list view you want to filter on, and select it
- Under Behaviour, look for the ShowAutoFilterRow property and set it to true.
- Rebuild and deploy your application.
You should now see an unintuitively blank row below your list view headers. Go ahead and type anything in and you should see the filters take effect, as well as the filter criteria (which you can click on to modify via a GUI).
That’s quite a lot of framework and scaffolding DevExpress is providing. I’m surprised how easy it is to allow dynamic, smart filtering on any field.