I have an XF app where I have the following navigation stacks:
NavigationPage
TabbedPage
NavigationPage (this is the root of the 1. tab)
ContentPage1
NavigationPage (this is the root of the 2. tab)
ContentPage2 (currently active page)
NavigationPage (this is the root of the 3. tab)
ContentPage3
What I want to accomplish is to navigate, with a URL, from the currently active page to a page that gets pushed onto the root NavigationPage's stack resulting in something like this:
NavigationPage
TabbedPage
NavigationPage (this is the root of the 1. tab)
ContentPage1
NavigationPage (this is the root of the 2. tab)
ContentPage2
NavigationPage (this is the root of the 3. tab)
ContentPage3
ContentPage3 (new active page)
If I try to do this by navigating to /NavigationPage/ContentPage3 the TabbedPage and all subpages are destroyed. If I instead use /NavigationPage/TabbedPage/ContentPage3 the TabbedPage and subpages are still destroyed, but then recreated to make the URL match.
I'd like to accomplish this without destroying the existing pages.
The only way I know to not to destroy existing pages is to use an Modal Page.
You can modify the Appearance of the ModalPage so that appears like a normal page.
Also, while navigating you can set the animation to false so that the Page appears directly without animation.
Related
I'm having a requirement where I click a button then I need to initialise the tab and its children, and also I need to push a new page on top of this, which shouldn't show the tabs below, and when I press back it should go back to the previous tabbed page with the children being active from where I navigated from
I know that I can do this by
CurrentPage = Children[2];
This would give me the result of navigating to the specific child of a tabbed page, but how can I navigate to a page further is something I'm not able to figure out
With the standard (template) implementation of Master Detail Page, I do not get a back button when I call the side menu.
Standard implementation looks like this:
<NavigationPage>
<x:Arguments>
<local:DetailPage1/>
</x:Arguments>
</NavigationPage>
But when I implement navigation in this way:
MainPage = new NavigationPage(new MainPage());
i get the button back
Why does this happen and why I do not get a button with the standard (template) implementation? Thanks
screenshot with a running button at the bottom
enter image description here
First of all - the menu (master page) should not have a back button.
From the official documentation:
A MasterDetailPage is designed to be a root page, and using it as a
child page in other page types could result in unexpected and
inconsistent behavior. In addition, it's recommended that the master
page of a MasterDetailPage should always be a ContentPage instance,
and that the detail page should only be populated with TabbedPage,
NavigationPage, and ContentPage instances. This will help to ensure a
consistent user experience across all platforms.
If your MasterDetailPage is not a root page and it is wrapped by a NavigationPage you may see the back arrow.
That should answer your question. Additional details and restrictions are listed in the same official doc.
I'm using Xamarin.Forms with PRISM. My app start with navigating to MyMasterDetailPage/MyNavigationPage/MainPage. From the master page, I want to navigate to page2 and have a back arrow instead of the hamburger icon. Pressing that takes you back to MainPage and the hamburger icon is back. I have tried navigating to MyNavigationPage/page2 andMyMasterDetailPage/MyNavigationPage/page2` but it seems to be clearing the back stack. There may be other pages that need the behavior that I'm currently seeing, so being able to configure the behavior would be ideal (not always one way or the other).
You need to implement the INavigationPageOptions interface on your MyNavigationPage and set the ClearNavigationStackOnNavigation property to false.
I'm making app with using Xamarin.forms.
I'm creating my own tabbar.
But for that, I have to attach this tabs on most high depth windows.
for example, If new navigation page is pushed on iOS, it must be on that.
How to access most top depth's layout? (I want to add child my tabs on that)
1) Make your tabbar a ContentView
2) On each of your page add the tabbar as the last child of your Content (being an AbsoluteLayout for example)
I have an application with a lot of screens, let say HomePage, Section Screen and Detail Page, Category Screen.
I use a NavigationController to Navigate from HomePage to Section Screen.
In the SectionScreen I have used a SideBarController component (https://components.xamarin.com/view/sidebarnavigation) to implement a navigation drawer or a flyout menu.
The problem is how to navigate from Section Screen to Detail Page or to Category Screen. I need to make this kind of navigation from MenuController or ContentController.
I don't want to just change the contentView. I want to push another UIViewController.
I have used the usual one:
this.NavigationController.PushViewController( new UIViewControllerExample(), true);
but there are some problems:
In the details page I can't access the NavigationBar
When I press back, the app crashes with an error:
Cant add self to subview
This is how to it should look like.
This is the problem. The first image display what happen when i use the above code,
Any idea how to solve this.
as you can find in that page of component you should use SidebarController as your navigationcontroller
SidebarController.ChangeContentView(new OtherContentController());