locked
how to remove Frame.BackStackDepth RRS feed

  • Question

  • Hi

    I am developing a windows 8.1 app which includes several pages. I want to know how can I remove Frame.BackStackDepth so that when the user press the back button the app will navigate the control to the first page.

    I tried this but its not working .

    private void backButton_Click(object sender, RoutedEventArgs e)
            {
                this.Frame.BackStack.Remove(this.Frame.BackStackDepth);
                this.Frame.GoBack();
            }
            


    samEE

    Friday, April 10, 2015 7:44 AM

Answers

  • Hi Sameel,

    You can use following code to remove back-stack and  go First  Page

    private void backButton_Click(object sender, RoutedEventArgs e) {

    var rootFrame = (Window.Current.Content as Frame); rootFrame.Navigate(typeof(FirstPage)); rootFrame.BackStack.Clear(); }


    Don't forget to mark the right answer and vote up if helps you.

    • Marked as answer by Sameel Nawaz Saturday, April 11, 2015 5:59 AM
    Saturday, April 11, 2015 5:29 AM