当列表很大时,过滤会变慢。有没有更快的方法来处理过滤器?目前这就是我所拥有的。
CollectionViewSource orderListCVS;
private void showCompletedRB(object sender, RoutedEventArgs e)
{
CollectionView coll = orderListCVS.View as CollectionView;
coll.Filter = null;
orderListCVS.Filter += new FilterEventHandler(showCompletedFilter);
}
private void showCompletedFilter(object sender, FilterEventArgs e)
{
Order order = e.Item as Order;
if (order != null)
{
e.Accepted = (order.Status == Data.Status.Done);
}
}