Excel-Style Auto-Filtering List Views in DevExpress

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:

  1. Double-click on your .xafml file to load up the model editor
  2. Uncheck the Views node (see screenshot)
  3. Find the list view you want to filter on, and select it
  4. Under Behaviour, look for the ShowAutoFilterRow property and set it to true.
  5. 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.

About Ashiq Alibhai, PMP

Ashiq has been coding C# since 2005. A desktop, web, and RIA application developer, he's touched ASP.NET MVC, ActiveRecord, Silverlight, NUnit, and all kinds of exciting .NET technologies. He started C# City in order to accelerate his .NET learning.
This entry was posted in Libraries, Web, Wndows Forms and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *