Wp7 refresh page from App.xaml.cs

i'v added some button to my ApplicationBar, which also has an update, and I attached an onClick event handler to it, but I included this applicationBar in App.xaml and I included it in all my pages, so now getting it accurate uri from which the refresh button ( ReloadUri ) was pressed with this code --->

 private void ReloadBtn_Click(object sender, EventArgs e) { var ReloadUri = (((App)Application.Current).RootFrame.Content as PhoneApplicationPage).NavigationService.CurrentSource; (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(ReloadUri); } 

but the second line of code does not move above the page ( navigation does not work )

+4
source share
1 answer

solved!
fixed problem using no-cache parameter --->

 (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri(ReloadUri +"?no-cache="+Guid.NewGuid(), UriKind.Relative)); 
+2
source

Source: https://habr.com/ru/post/1483132/


All Articles