Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

ObservableCollection with "filter"

$
0
0

Hi.
I have a MYCLASS class with INotifyPropertyChange
I've, in "App", a ObservableCollection List {get;set;}

After filled List, I use it in a listview
listview.ItemSource = List;

In this listview I've a ViewCell where Buttons Add and Remove item in List.
This actions update the listview correctly.

I've a problem if I "filter" the list
listeview.ItemSource = List.Where(o=>o.field== 1)

In this case, Add and Remove Buttons don't update the listview, BUT, If I modify a property in "List", the viewcell modify the control binded to the property correctly (I hope to be clear)...

How can I use observablecollection "filtered" and have the list correctly updated when Add and Remove items in "List"?
(this because I have X tab with X listview and every listview should have
listview.ItemSource = List.Where(o=>o.field==1),
listview.ItemSource = List.Where(o=>o.field==2),

...

...

listview.ItemSource = List.Where(o=>o.field==X),

Thanks
Alessandro


Viewing all articles
Browse latest Browse all 58056

Trending Articles