예제 #1
0
 public void ShowNestedSample <TPage>(bool clearStack = false) where TPage : Page
 {
     if (NestedSampleFrame.Navigate(typeof(TPage)) && clearStack)
     {
         NestedSampleFrame.BackStack.Clear();
     }
 }
예제 #2
0
        public void ShowNestedSample <TPage>(bool?clearStack = null) where TPage : Page
        {
            var wasFrameEmpty = NestedSampleFrame.Content == null;

            if (NestedSampleFrame.Navigate(typeof(TPage)) && (clearStack ?? wasFrameEmpty))
            {
                NestedSampleFrame.BackStack.Clear();
            }
        }
예제 #3
0
        public Shell()
        {
            this.InitializeComponent();

            InitializeSafeArea();
            this.Loaded += OnLoaded;

            NestedSampleFrame.RegisterPropertyChangedCallback(ContentControl.ContentProperty, OnNestedSampleFrameChanged);
            SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) => e.Handled = BackNavigateFromNestedSample();
        }
예제 #4
0
        public bool BackNavigateFromNestedSample()
        {
            if (NestedSampleFrame.Content == null)
            {
                return(false);
            }

            if (NestedSampleFrame.CanGoBack)
            {
                NestedSampleFrame.GoBack();
            }
            else
            {
                NestedSampleFrame.Content = null;

#if __IOS__
                // This will force reset the UINavigationController, to prevent the back button from appearing when the stack is supposely empty.
                // note: Merely setting the Frame.Content to null, doesnt fully reset the stack.
                // When revisiting the page1 again, the previous page1 is still in the UINavigationController stack
                // causing a back button to appear that takes us back to the previous page1
                NestedSampleFrame.BackStack.Add(default);