-4

如何在 wp7 中刷新页面我试过这段代码

NavigationService.Navigate(new Uri(string.Format(NavigationService.Source +
                                        "?Refresh=true&random={0}", Guid.NewGuid()));

但它给出了错误

Navigation is only supported to relative URIs that are fragments, or begin with '/', or which contain ';component/'.
Parameter name: uri

因此,请尽快将解决方案发送给我。

4

3 回答 3

4

你不能直接放你页面的URI吗?此外,明确将您的 URI 设置为相对的。就像是:

NavigationService.Navigate(new Uri(string.Format("/MyPage.xaml?Refresh=true&random={0}", Guid.NewGuid()), UriKind.Relative);
于 2012-10-12T06:05:59.907 回答
0

试试这个论坛的以下帖子:

“看起来 UriMapper 对象没有针对框架创建。将 UriMapper 属性添加到框架并将其指向设置映射的资源似乎已修复它。因此在页面中包含框架的 xaml 现在看起来像 ....”

<navigation:Frame Grid.Row="1" x:Name="Frame" 
                                  HorizontalContentAlignment="Stretch"
                                  VerticalContentAlignment="Stretch"
                                  Padding="0"
                                  Background="White"
                                  JournalOwnership="OwnsJournal"

                                  UriMapper="{StaticResource uriMapper}"    />

在 App.xaml 应用程序资源中我有....

<navigationCore:UriMapper x:Key="uriMapper">
<navigationCore:UriMapping Uri="Contracts" MappedUri="/Views/Contracts.xaml" />
</navigationCore:UriMapper>
于 2012-10-12T05:43:48.413 回答
-1

我认为 KooKiz 的方法是正确的。

我不知道你为什么会撞车。在你新的另一个之后你会清理你的backstack吗?

于 2012-10-12T08:55:07.057 回答