Now I am trying to do clear the cache and the collection in the GroupedItemsPage this is part of the code:
if (DefaultViewModel.Keys.Contains("Groups"))
{
base.ClearNavigationCache();
// TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"]
var sampleDataGroups = VMDataSource.GetGroups((String)navigationParameter);
this.DefaultViewModel["Groups"] = sampleDataGroups;
}
else
{
// TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"]
var sampleDataGroups = VMDataSource.GetGroups((String)navigationParameter);
this.DefaultViewModel["Groups"] = sampleDataGroups;
}
Than after the base.ClearNavigationCache I want to set the allGroups to null from the DataSource.
This is the DataSource:
private static VMDataSource _sampleDataSource = new VMDataSource();
private ObservableCollection<VMDataGroup> _allGroups = new ObservableCollection<VMDataGroup>();
public ObservableCollection<VMDataGroup> AllGroups
{
get { return this._allGroups; }
set { this._allGroups = value; }
}
public static IEnumerable<VMDataGroup> GetGroups(string uniqueId)
{
if (!uniqueId.Equals("AllGroups")) throw new ArgumentException("Only 'AllGroups' is supported as a collection of groups");
return _sampleDataSource.AllGroups;
}
I implement the set for allGroups to set it to null cause the first time I load the app and choose a Category the code goes into the else on the code, after I navigate back to the mainPage I select another category but it still shows me the old data.
First loading the app, when it enters the GetGroups(string uniqueId) the return _sampleDataSource.AllGroups; is count "0" but after I choose another category and navigate to that same page the return _sampleDataSource.AllGroups; is count 1 so I think maybe set the allGroups to null on the GroupedItemsPage. Thanks.
Thanks, Smiths
No comments:
Post a Comment