You are here

How to clear the back stack in Windows RT (Windows Store) apps

Once you have set [geshifilter-code]Window.Current.Content[/geshifilter-code] to a [geshifilter-code]Frame[/geshifilter-code], save a copy of the navigation stack.

[geshifilter-cs]// After the main application frame is established, save its navigation state. var appFrame = Window.Current.Content = new Frame(); var emptyNavState = appFrame .GetNavigationState(); // Here we're pushing a page onto the stack. appFrame.NavigateTo(foo); // If we want to clear the stack, this won't work: // appFrame.GoBack(); // So instead we simply restore the navigation state to its empty state. appFrame.SetNavigationState(emptyNavState); [/geshifilter-cs]

Add new comment

Simple Copyright Policy: If you want to reproduce anything on this site, get my permission first.