Reputation: 21126
I am using App.RootFrame.GoBack(); but it does not refresh the page (which makes sense).
I would like to enforce a page refresh... Anyway of doing this?
Upvotes: 0
Views: 153
Reputation: 1360
on a 'GoBack()' the OnNavigatedTo() method will be run, but the constructor for the page won't be. Therefore you need to refresh the page yourself in the OnNavigatedTo() method.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// Refresh the data in here
}
Also I would suspect that you would be better of using the navigationservice to go back i.e:
NavigationService.GoBack();
Upvotes: 0
Reputation: 2599
Possible duplicate of this.
In any event, you probably want to use the NavigationService as follows:
if(NavigationService.CanGoBack())
{
NavigationService.GoBack();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// ensure view has the data it needs
}
Upvotes: 1
Reputation: 21126
This seemed to do the job well.
IEnumerable<JournalEntry> pages = App.RootFrame.BackStack;
string pageURL = pages.First().Source.OriginalString;
App.RootFrame.Navigate(new Uri(pageURL + "?Refresh=true&random=" + Guid.NewGuid(), UriKind.RelativeOrAbsolute));
Upvotes: 0