![](/img/trans.png)
[英]Windows Phone 8.1 Voice Recognition + NavigationService problems
[英]Equivalent method to NavigationService.Refresh in Windows Phone 8.1?
我想刷新WP 8.1中我的應用程序目錄的內容。 在WP 8中,有:
NavigationService.Refresh()
但是我無法在8.1中找到任何類似的東西。
有什么建議么?
剛在msdn中看到, Frame.Refresh()
中有一個Frame.Refresh()
方法。 您應該從此開始。
NavigationService.Refresh()
在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);
}
}
編輯:
本示例適用於wp8。 對於wp8.1,您必須使用: Frame.Navigate(typeof(Refresh));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.