2014-12-20 69 views

回答

0

剛纔看到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));

source

+0

謝謝,這個工作! – Batfink02

相關問題