如何防止回到前一页 [英] how to prevent going back to previous page

查看:155
本文介绍了如何防止回到前一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关一款Windows Phone 8应用我发展,我不得不在应用程序的启动加载一些数据。对于这个问题,我设计了一个名为页 SplashScreen.xaml 加载数据和所有的装载完成后,我浏览到 MainPage.xaml中使用:

For a windows phone 8 app I'm developing, I had to load some data at the starting of the app. For that matter I designed a page called SplashScreen.xaml that loads the data and after all the loading is done I navigate to the MainPage.xaml using:

    NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));

现在的应用程序(这是默认的手势)可以追溯到 SplashScreen.xaml ,使得他们无法出门的应用程序(除了录音启动按钮,内搭是的应用背景),当然给他们留下不好的印象。
的问题是,如何防止回到前一页
谢谢大家。

Now when the user is in the main page and taps the back button on the phone instead of going out of the app(which is the default gesture) goes back to the SplashScreen.xaml, making them unable to go out of the app(except for taping the start button which take's the app to background) and of course giving them a bad impression. The question is How to prevent going back to the previous page Thank you all.

推荐答案

上的MainPage降落时只需清除backstack:

Just clear the backstack when landing on MainPage:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    while (NavigationService.RemoveBackEntry() != null);
}

这篇关于如何防止回到前一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆