sort and filter a list

sort and filter a list

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


paul_rockerdale posted on Tuesday, December 20, 2011

Hi and Merry Christmas,

I'm using clsa4, wpf, mvvm with bxf. I have readonly child list that i want to sort and filter in various way. What's the best way? I'm currently using LINQ to bind an IEnummerable list from my view model and leaving the readonly csla child list in the viewmodel. This seems totally wrong as i feel I should be creating a view onto my source, I know wpf has a collectoionview source with a view property but to take full control I would have to do code behind. Any advice is welcome.

Curelom replied on Wednesday, December 21, 2011

You can create a public dependency property on your view model that returns a sorted IEnumerable list from the readonly child list.  In your view you could either bind directly to that ViewModel property or to a collectionviewsource that is bound to it.  No need for code behind.

Copyright (c) Marimer LLC