Retrieve List from listView.ItemsSource

I'd like to do a simple thing : Retrieve a ListView ItemsSource to use Linq on it and give it again to the Listview, like :

LV1.ItemsSource = LV1.ItemsSource.Where(x => x.age > 10);

Can I do it somehow ?

Upvotes: 0

Views: 668

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222682

Cast it to the type and then bind,

var filterResult =  LV1.ItemsSource as List<yourclass>;
LV1.ItemsSource =filterResult .Where(x => x.age > 10);

Upvotes: 1

Related Questions