简体   繁体   中英

How to Navigate to the main Page on Windows Phone 8.1

please, can you tell me how to use Frame.Navigate(typeof(MainPage)); to go to the main Page from any Page closing all pages in stack?

I tried to use this code:

for (int i = 0; i < Frame.BackStack.Count; i++)
{
    Frame.BackStack.RemoveAt(i);
}
Frame.Navigate(typeof(HomePage));

But doesn't work, because when I press the back key button the pages however open.

Thanks very much!

如果您只想使整个后背堆栈消失,请使用

Frame.BackStack.Clear();

First navigate to MainPage then clear the backstack

Frame.Navigate(typeof(MainPage));
Frame.BackStack.Clear();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM