WPF, BusinessListBase, filter

WPF, BusinessListBase, filter

Old forum URL: forums.lhotka.net/forums/t/8352.aspx

fsl posted on Thursday, January 14, 2010

Hi there

What is the recommended way of filtering a databound businesslistbase collection in WPF?

RockfordLhotka replied on Thursday, January 14, 2010

Use either a LINQ query or FilteredBindingList. Probably a LINQ query though, as FilteredBindingList is more geared toward Windows Forms.

var filtered = from r in _mylist where r.SalesTotal > 1000 select r;

Assuming _mylist is a BLB, you'll get back a LinqBindingList, which is a synchronized view over the original list, and you can bind that to your UI.

fsl replied on Thursday, January 14, 2010

Thank you. Couldn't have asked for more.

Copyright (c) Marimer LLC