I have a CollectionViewSource that is binding to an subset of an observable collection to show the top n articles on the main page.
<CollectionViewSource
x:Name="groupedItemsViewSource"
Source="{Binding Groups}"
IsSourceGrouped="true"
ItemsPath="TopItems" />
In my code I do the following:
protected async override void LoadState(Object navigationParameter, ...)
{
var feedDataSource = (FeedDataSource)navigationParameter;
this.DefaultViewModel["Groups"] = feedDataSource.Feeds;
}
My FeedDataSource contains an ObservableCollection<FeedCategory> Feeds which has an ObservableCollection<FeedItem> Items and TopItems :
public ObservableCollection<FeedItem> TopItems
{
get { return new ObservableCollection<FeedItem>(this.Items.Take(5)); }
}
Now - I have added a refresh method which adds more FeedItems to the Items collection however when I refresh, it has no effect on the Grid View on my main page which uses the groupedItemsViewSource for it's ItemsSource property.
ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
If I navigate away from the page, and then back again (so the page gets rebuilt) the new items are there. Why isn't my GridView showing these changes as they happen? I thought that by binding the collection and grid view they should reflect these changes? I have tried changing them to two one, one way - but it makes no difference.
Can anyone shed some light as to why this isn't working?