In my small WPF project, I have a TabControl
with three tabs. On each tab is a ListBox
. This project keeps track of groceries we need to buy. (No, it's not homework, it's for my wife.) So I have a list of ShoppingListItem
s, each of which has a Name
and a Needed
property: true
when we need the item, and false
after we buy it.
So the three tabs are All, Bought, and Needed. They should all point to the same ShoppingListItemCollection
(which inherits from ObservableCollection<ShoppingListItem>
). But Bought should only show the items where Needed is false, and Needed should only show items where Needed is true. (The All tab has checkboxes on the items.)
This doesn't seem that hard, but after a couple hours, I'm no closer to figuring this out. It seems like a CollectionView or CollectionViewSource is what I need, but I can't get anything to happen; I check and uncheck the boxes on the All tab, and the items on the other two tabs just sit there staring at me.
Any ideas?