0

I'm new to Windows Phone 8 development. I've been working with it for about a month now and have written my own news app consuming data from an API. I save article content offline into the app's local storage as .json files. Since I have already them saved offline I want to give my users the ability to 'save' that article to a list of favourites and have one of my pivot items show the list of saved articles for them to access later. I also want that list manageable by the user i.e. I want them to be able to delete the items as necessary.

I'm planning on loading the data context for the list using an object called:

SavedArticles

which is simply a

List<Article>

I've read a lot about how to update the current view using INotifyPropertyChanged, but I think that is more about updating properties of existing items in the list. What I need is something that can update the ItemsSource after the user selects an item and then clicks delete in the AppBar. I think that is where INotifyCollectionChanged should come in, but for the life of me, I can't see how to implement it.

Looking for someone to enlighten me or point me at a great example.

I have Googled this to death but cannot find many examples and the ones I have seen, I'm just not getting.

Thanks!

ItsMe-Rodders
  • 291
  • 2
  • 4

1 Answers1

0

Instead of using List<Article> use an ObservableCollection<Article> (from System.Collections.ObjectModel) as this implements INotifyCollectionChanged.
This means that when you remove an item from the underlying collection (which is what your delete function should do) then this will be reflected in the databound UI collection.

Matt Lacey
  • 65,560
  • 11
  • 91
  • 143