User Tools

Site Tools


notes:uwp:navigation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
notes:uwp:navigation [2017/02/10]
admin
notes:uwp:navigation [2018/01/29] (current)
leszek
Line 87: Line 87:
 } }
 </​code>​ </​code>​
 +
 +Example: Replace a navigation parameter on the back stack for the last page (the page on the top of the stack):
 +<code csharp>
 +public void PushParameterToBackStack(object parameter, Frame frame)
 +{
 +    var backStack = frame.BackStack;​
 +    var backStackCount = backStack.Count;​
 +
 +    // A way of passing a parameter to a page regardless if Navigate or GoBack is called.
 +    if (backStackCount > 0)
 +    {
 +        var pageEntry = backStack[backStackCount - 1];
 +        backStack.RemoveAt(backStackCount - 1);
 +
 +        // Prepare the navigation parameter for the main page.
 +        var newEntry = new PageStackEntry(
 +            pageEntry.SourcePageType,​
 +            parameter,
 +            pageEntry.NavigationTransitionInfo);​
 +        backStack.Add(newEntry);​
 +    }
 +}
 +</​code>​
 +
notes/uwp/navigation.txt ยท Last modified: 2018/01/29 by leszek