Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Windows Phone 8.1中NavigationService.Refresh的等效方法?_C#_Windows_Windows Phone 8.1 - Fatal编程技术网

C# Windows Phone 8.1中NavigationService.Refresh的等效方法?

C# Windows Phone 8.1中NavigationService.Refresh的等效方法?,c#,windows,windows-phone-8.1,C#,Windows,Windows Phone 8.1,我想刷新WP 8.1中我的应用程序apge的内容。在WP 8中,有: NavigationService.Refresh() 但是我在8.1中找不到类似的东西 有什么建议吗?刚刚看到wp8.1中有一个Frame.Refresh方法。你应该从这个开始 导航服务,刷新 以下是@justinmchase的一个技巧: 例如,导航到另一个页面Refresh.xaml private void OnAllowClick(object sender, RoutedEventArgs e) { Locat

我想刷新WP 8.1中我的应用程序apge的内容。在WP 8中,有:

NavigationService.Refresh()
但是我在8.1中找不到类似的东西

有什么建议吗?

刚刚看到wp8.1中有一个Frame.Refresh方法。你应该从这个开始

导航服务,刷新

以下是@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.navigateTypeofresh