如何在 wp7 中刷新页面



如何在 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

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

你不能直接输入页面的 URI 吗?此外,将 URI 显式设置为相对。像这样:

NavigationService.Navigate(new Uri(string.Format("/MyPage.xaml?Refresh=true&random={0}", Guid.NewGuid()), UriKind.Relative);

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

"看起来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>

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

我不知道你为什么会崩溃. 您是否在更换另一个后清除了后堆栈?

最新更新