0
我想在WP 8.1中刷新我的應用程序的內容。在WP 8中,有:Windows Phone 8.1中的NavigationService.Refresh的等效方法?
NavigationService.Refresh()
但我在8.1中一直沒有找到類似的東西。
有什麼建議嗎?
我想在WP 8.1中刷新我的應用程序的內容。在WP 8中,有:Windows Phone 8.1中的NavigationService.Refresh的等效方法?
NavigationService.Refresh()
但我在8.1中一直沒有找到類似的東西。
有什麼建議嗎?
剛纔看到msdn在wp8.1中有一個Frame.Refresh()
方法。你應該從這個開始。
NavigationService.Refresh()
does not exist on WindowsPhone。
這裏是@justinmchase一招:
導航到另一個頁面(Refresh.xaml例如)
private void OnAllowClick(object sender, RoutedEventArgs e)
{
LocationService.AllowLocationServices = true;
this.NavigationService.Navigate(new Uri("/Views/Refresh.xaml", UriKind.Relative));
}
回來到您的網頁
public partial class Refresh : PhoneApplicationPage
{
public Refresh()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var j = this.NavigationService.RemoveBackEntry();
this.Dispatcher.BeginInvoke(() => App.RootFrame.Navigate(j.Source));
base.OnNavigatedTo(e);
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
this.NavigationService.RemoveBackEntry();
base.OnNavigatedTo(e);
}
}
編輯:
這個例子適用於w P8。對於wp8.1,你必須使用:Frame.Navigate(typeof(Refresh));
謝謝,這個工作! – Batfink02