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
Next revision
Previous revision
notes:uwp:navigation [2017/02/10]
admin
notes:uwp:navigation [2018/01/29] (current)
leszek
Line 47: Line 47:
       xmlns="​http://​schemas.microsoft.com/​winfx/​2006/​xaml/​presentation"​       xmlns="​http://​schemas.microsoft.com/​winfx/​2006/​xaml/​presentation"​
       xmlns:​x="​http://​schemas.microsoft.com/​winfx/​2006/​xaml">​       xmlns:​x="​http://​schemas.microsoft.com/​winfx/​2006/​xaml">​
- <Frame x:​Name="​RootFrame"​ />+      ​<Frame x:​Name="​RootFrame"​ />
 </​Page>​ </​Page>​
 </​code>​ </​code>​
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.1486785903.txt.gz ยท Last modified: 2017/02/10 by admin