Kut*_*müş 2 c# xaml windows-phone-7 windows-phone-8
我是Windows手机平台上的新手.我正在尝试制作新闻申请.在此应用程序中,用户点击并阅读新闻文章,之后,用户想要回到主页再次查看所有新闻标题,并再次点击其他新闻.
但是当用户在阅读第一篇文章后返回主页时,用户点击第二个新闻标题.但是当用户导航到新页面时,第一篇新闻文章仍然存在.
我想问一下,当用户按下主页时,是否有用户(阅读第一篇新闻文章后)用于清除文章页面缓存的后退按钮?
我用过这个,但它没有;
private void ApplicationBarIconButton_Click_1(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
}
Run Code Online (Sandbox Code Playgroud)
我在我的httprequest下写了一些东西,但它对我也没有用;
private void LiveLongListSelector_Loaded(object sender, RoutedEventArgs e)
{
string url = "MYWEBAPIURL&rnd=" + new Random().Next(1,1000);
HttpWebRequest hWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
hWebRequest.Method = "GET";
hWebRequest.BeginGetResponse(ResponseLive_Completed, hWebRequest);
hWebRequest.Headers[HttpRequestHeader.CacheControl] = "no-cache";
hWebRequest.Headers[HttpRequestHeader.CacheControl] = "no-cache";
hWebRequest.Headers["Cache-Control"] = "no-cache";
hWebRequest.Headers["Pragma"] = "no-cache";
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我找到完美的后退按钮或其他东西吗?
非常感谢你
小智 5
只需使用NavigationService.GoBack();
而不是使用
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
Run Code Online (Sandbox Code Playgroud)
它将自动清除所有捕获.
或者你可以NavigationService.RemoveBackEntry();
在再来时阅读第二篇文章.使用像 -
int a = NavigationService.BackStack.Count();
while (a > number) //number is stack count when comes to main page first time
{
this.NavigationService.RemoveBackEntry();
a = NavigationService.BackStack.Count();
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3313 次 |
最近记录: |