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
Last revision Both sides next revision
notes:uwp:navigation [2017/02/10]
admin
notes:uwp:navigation [2017/02/10]
admin
Line 41: Line 41:
 </​code>​ </​code>​
  
 +Example: Create a page (RootHost) that serves as a proxy to a frame object. It gives you the ability to overlay content on top of any of the windows in your application.
  
 +<code xml>
 +<Page x:​Class="​WBS.TestApp.RootHostPage"​
 +      xmlns="​http://​schemas.microsoft.com/​winfx/​2006/​xaml/​presentation"​
 +      xmlns:​x="​http://​schemas.microsoft.com/​winfx/​2006/​xaml">​
 +      <Frame x:​Name="​RootFrame"​ />
 +</​Page>​
 +</​code>​
 +
 +<code csharp>
 +namespace WBS.TestApp
 +{
 +    public sealed partial class RootHostPage : Page
 +    {
 +        public RootHostPage()
 +        {
 +            this.InitializeComponent();​
 +
 +            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
 +                AppViewBackButtonVisibility.Visible;​
 +            SystemNavigationManager.GetForCurrentView().BackRequested += RootHostPage_BackRequested;​
 +
 +            this.Loaded += RootHostPage_Loaded;​
 +        }
 +
 +        private void RootHostPage_Loaded(object sender, RoutedEventArgs args)
 +        {
 +            RootFrame.Navigate(typeof(MyPage2));​ // MyPage2 is another page in the app
 +        }
 +
 +        private void RootHostPage_BackRequested(object sender, BackRequestedEventArgs args)
 +        {
 +            if (RootFrame.CanGoBack)
 +            {
 +                args.Handled = true;
 +                RootFrame.GoBack();​
 +            }
 +            else
 +            {
 +                args.Handled = false;
 +            }
 +        }
 +    }
 +}
 +</​code>​
notes/uwp/navigation.txt ยท Last modified: 2018/01/29 by leszek