4
votes

I need to refresh a page in wp7. Searched in google and get this

NavigationService.Navigate(new Uri(NavigationService.Source + "?Refresh=true", UriKind.Relative));

but when I am using this there is an error, ie the application breaks.

How can I refresh the current page in wp7?

2
Just wondering why you are refeshing rather than using INotifyPropertyChanged on your objects / Observablecollection<>s? I can think of a couple of valid use cases, but was wondering...ZombieSheep
For example, I used this because an initially collapsed panorama item could not be made visible without messing up the layout of the panorama, so I had to "reload" the page.Mark Vincze

2 Answers

9
votes

Just provide a unique URL ID and it will reload the same page. You can generate a random number, but the easiest way is probably with a GUID.

NavigationService.Navigate(new Uri(string.Format(NavigationService.Source +
                                    "?Refresh=true&random={0}", Guid.NewGuid()));
1
votes

Try this:

NavigationService.Navigate(new Uri( "/Game.xaml?Refresh=true", UriKind.Relative) );