How do you filter a view of a DataTable in .Net 3.5 sp1 using WPF c# and xaml? -


i found msdn example code getting default view of collection , adding filter view, of .net 4.0. i'm on team not switching 4.0, don't have option. none of examples found used datatable source, had adapt little. i'm using datatable because data comming db ans it's easy populate. after trying implement msdn examples, "notsupportedexception" when try set filter. c# code have:

protected datatable _data = new datatable();
protected bindinglistcollectionview _filtereddataview;
...
private void on_loaded(object sender, routedeventargs e)
{
_filtereddataview = (bindinglistcollectionview)collectionviewsource.getdefaultview(_data); _filtereddataview.filter = new predicate(matchescurrentselections); // throws notsupportedexception
}
...
public bool matchescurrentselections(object o){...}

it seems either bindinglistcollectionview not support filtering in .net 3.5, or doesn't work datatable. looked @ setting in xaml instead of c# code, xaml examples use collections in resources instead of collection memberof class, have no idea how set up. 1 know how filter view datatable?

edit

i stopped looking while ago, thought update question. not built-in filtering work. seems easier .net 4.0 resorted re-querying data different conditions each time desired filtering changes. in application's environment, has worked , quick.

bindinglistcollectionview not support filtering nor sorting. use collectionviewsource create instance of listcollectionview instead supports both.


Comments

Popular posts from this blog

Delphi Wmi Query on a Remote Machine -