I have a masterdetailview that uses prism. When I click on one of the menu items the hamburger menu shows up on the nav bar of the new page I clicked and I really just want the top nav bar to show a back button and be able to go back. How can I achieve this ?
When my app loads I call
await NavigationService.NavigateAsync("/MainPage/NavigationPage");
I figured I could call
await NavigationService.NavigateAsync("/MainPage/NavigationPage/InviteFriends");
and this would provide the newpage with a back button to Home but when I do this it doesn't do anything
EDIT
if I change to
await NavigationService.NavigateAsync("/MainPage/NavigationPage/FeaturePage");
which is what the home page will be called(Feature Page) it will not load the page at all.
MainPage is my list of other pages to go to that is shown when the hamburger is pressed if that helps. Feature page is the page I would want to show below the hamburger page and be the "Home" screen.
am I doing that correctly ?
So if we take your example you have the following Navigation Stack:
MainPage/NavigationPage
Let's assume your navigation code looks like this in the Master-Detail View Model
await NavigationService.NavigateAsync("/MainPage/NavigationPage/InviteFriends");
This will lead to the following Navigation Stack:
/MainPage/NavigationPage/InviteFriends
This is because the navigation was called from the master-detail page.
The master-detail page is considered a root page in Prism and when navigating from a Master-detail page it will set the target page as the detail page of the master-detail.
Check out this article for a more detailed breakdown Link
Be careful - Starting with /MainPage will clear the Navigation stack
One quick solution to this is to add your homepage to the navigation call:
await NavigationService.NavigateAsync("MainPage/NavigationPage/HomePage/InviteFriends");
This will create the following:
MasterDetailPage/NavigationPage/HomePage/InviteFriends
This should hopefully create the response you are looking for.
Hope this helped. Happy coding!
EDIT:
I think if you separate your initial Detail Page out into its own file you should then be able to do the following:
await NavigationService.NavigateAsync("MainPage/NavigationPage/HomePage/InviteFriends");
Related
I want to make a home button at the top of the Shell-based APP.
(Referring to the Xanimals app.)
The purpose of this home button is to move to one of the specific Routined pages in the Shell.
The gotoasync() function adds the previous page to the navigation stack by default, and the Backward button is enabled.
I don't want the back button, I just want to move like when you press the flyout button in Shell structure.
Please help me.
You could try this method which switches to a different navigation stack; assuming the home view is registered with a route name of home in your AppShell.xaml
await Shell.Current.GoToAsync("//home");
Here's a reference to all route formats:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/navigation#absolute-routes
Try the below method :
in your home button click event:
Shell.Current.CurrentItem.CurrentItem.Items.Add(Your new Page);
Shell.Current.CurrentItem.CurrentItem.Items.RemoveAt(0);
I have page called "Fund". I have bottom navigation with 5 tabs - "Home" / "Portfolio" and 3 others. In default behaviour all tabs has it's own navigation stack and if opened "Fund" in Home and then opened Portfolio when i return to Home "Fund" still be opened.
My goal is open default page for opened bottom navigation tab on every touch.
Here is the sample code {N} Playground
Solved in this issue
It's quite possible Frame.topmost() gets confused during tab
transition. However, you can access a certain tab frame and call
goBack() for it. Check this playground and let me know if it solves
your problem:
https://play.nativescript.org/?template=play-tsc&id=4Ij5yz&v=7
I would like to add in coding to change my "next" button into a "loading" Gif while it loads the next page. Apologies for the ignorant question but does that code go in the current page with the "next" button or does it go in the page to be loaded ? Essentially i would like it to display in the current page as the new page to be loaded looks completely different.
So in short, button says "next", they click it, it says "loading" once the new page is complete it must then reroute to that page.
Thanks in advance.
once user click on the search bar he/she directs to a model content page and after searching and selecting the search result. I want user to redirect to the second tab of a tabbed page.
is this possible using prism ?
Navigation for TabbedPages has been improved with Prism 7. Please see the blog post here
NavigateAsync(“TabbedPage?selectedTab=MiddleTab/ViewA/ViewB”)
This will navigate to the TabbedPage, selected the MiddleTab and continue navigating ViewA and ViewB onto the navigation stack.
The blog post ist not 100% clear, but don't take MiddleTab literally. Most likely this will be the class name of a view added to the TabbedPage.
I am developing an APP using Xamarin, i trying to apply an consistent navigation system for my app.
I have used xamarin master detail navigation and binded the master page with few details page through ObservableCollection list.
My default details page is again a tabbled page. Within Tabled page on click of some button i need open some content page which are not part of master page.
What i want is- any conent page should open within the master page means from any content page master page's header and left sliding menu should be easily available to user.
I am tryng to bind master page from content page on runtime but no luck yet. Please help.
====updating my query for better understanding===
1. Sample master details page look like below
[1
Click on item 1 open page 1 with sliding icon on left side of page title
Click on "GO TO PAGE 3" open page 3 with navigation back button. I think as this page is not bind to master page it shows normal back button. Basically i want to replace this navigation back button with "master detail" sliding button in every page those are not part of master page.
Please let me know how to replace navigation back button icon and behavior with master detail sliding button. I know following line of code can be used to open sliding menu but do not know how to hook the back button even.
(App.Current.MainPage as MasterDetailPage).IsPresented = true;