When I navigate within tabbed pages, OnNavigatingTo does not fire. There are several different threads around this subject but I don't see that there is a solution? My environment is a Main Page (login) > MasterDetails Page > Tabbed Page > Child Content Page.
_navigationService.NavigateAsync("MasterDetail/Navigation/DashboardPage/Child1TabPage");
<TabbedPage.Children>
<views:Child1TabPage/>
<views:Child2TabPage/>
</TabbedPage.Children>
I've tried using an additional navigation page either in the MainPage, or on the Dashboard page with useModalNavigation on or off but that doesn't work either. Like so.
navigationService.NavigateAsync("MasterDetail/Navigation/DashboardPage/NavigationTabbed/Child1TabPage", null, false, true);
or on the tabb DashboardPage like so
navigationService.NavigateAsync("NavigationTabbed/Child1TabPage", null, false, true);
Any ideas?
There is currently no mechanism built into Prism for Xamarin Forms that would call INavigationAware on Children of any MultiPage such as the TabbedPage or CarouselPage. This is a planned enhancement for Prism for Xamarin Forms 6.3 and should be available in Preview 3. You can follow the issue here.
Related
I've encountered an issue with the navigation bar height in the iOS version of my Xamarin Forms Prism app whereby it appears to be double height.
It displays correctly on Android.
I navigate to the page in the normal Prism way (ViewDaily is a Detail of the MasterDetailPage MainPage):
await NavigationService.NavigateAsync("/MainPage/NavigationPage/ViewDaily");
But the same also happens if I navigate to as a normal Navigation Page. This isn't my use case as I need the MasterDetail Page but i tried as a test:
await NavigationService.NavigateAsync("/NavigationPage/ViewDaily");
Any help gratefully received.
Navigate to ViewDaily only, otherwise you add another navigation page...
await NavigationService.NavigateAsync("ViewDaily");
Thanks to Dan Siegel for the answer:
https://github.com/PrismLibrary/Prism/issues/2511
Add the following to the Detail (Content) Page:
ios:Page.LargeTitleDisplay="Never"
Default Xamarin forms navigation page animation is not working when using master details page
I am setting the master page from App.Xaml.cs
MainPage = new NavigationPage(new MasterDetailPOS() { });
When I am navigating a page from another page,the second parameter is for animate.
Navigation.PushAsync(new Page1(),true)
page navigation animation not working.
When I am not using master detail page then this animation working fine.
so how to solve this?
I am using Prism for Xamarin Forms application development.
May be because I am new to both Prism and Xamarin Froms because of which I am facing a basic issue with the navigation.
Let me start with the details of my implementation and then the issue at hand.
I have a MasterDetail Page (named Home) which is my main page.
There are a few menu items in the Master Page. One of them is Partner.
On Click of Partner menu item, NavigationService.NavigateAsync("Navigation/Partner") method is called. Where "NavigationService" is of type "INavigationService".
This opens a page called "Partner" which is a tabbed page (TabbedPage). The first tab is a contentpage called "PartnerAll".
PartnerAll page contains a listview. On click of a list view item, a new page is opened "PartnerDetails" by calling NavigationService.NavigateAsync("Navigation/PartnerDetails", parameters, false, true);
On PartnerDetails page, I have added a toolbaritem called "Cancel".
Issue: When "PartnerDetails" page opens up, "Cancel" item shows up twice, as shown in the screenshot:
screenshot of partner details page with two cancel buttons
Where is it I am going wrong. What should I do to make it work?
Please assist.
Best regards, Ankur Jain
You’re pushing two NavigationPage’s onto the Navigation Stack. This would result in two Navigation bars. You can see in your screenshot you have both a back and a hamburger menu icon.
You should just pass in the identifier string for your destination page, instead of pushing another instance of the NavigationPage onto the stack
do it like so NavigationService.NavigateAsync(PartnerDetails);
I am using Xamarin Forms with Prism. How do you navigate from the MasterDetail.Master to a ContentPage that is not part of the MasterDetail (that is, I don't want to just update the detail and continue to be part of the Master/Detail relationship)? The use case is like the Gmail app when you click on Settings from the Hamburger menu. It takes you out of the Master/Detail and you are now in a NavigationPage/ContentPage with a back button to get back to the MasterDetail page.
If you were not using Prism you could go to the Detail page and do a Navigation.PushAsync from there:
var mdp = Application.Current.MainPage as MasterDetailPage;
mdp.IsPresented = false;
await mdp.Detail.Navigation.PushAsync(new ContentPage2());
But I don't see how to do this using Prism navigation.
-Steve
Assuming your Application.Current.MainPage is a MasterDetailPage. Current Detail in the MasterDetailPage is NavigationPage(new ContentPage1()).
In your ContentPage1, you have 2 options to navigate to ContentPage2:
Option 1: Show ContentPage2 in current navigation stack
You will be pushing ContentPage2 into the same Navigation stack of ContentPage1. Back button in navigation bar will be added automatically.
// Call this code in ContentPage1
_navigationService.PushAsync("ContentPage2");
Option 2: Show ContentPage2 modally
You are presenting the page modally and in a completely new navigation stack. You will need to add Back button in the NavigationBar and handle the click event with your own code.
// Call this code in ContentPage1
_navigationService.PushAsync("NavigationPage/ContentPage2", null, true);
I've been tinkering with Xamarin forms and I have run into a bit of a road block. I have an app whose rootPage is a TabbedPage. I programmatically add three child Contentpages to this page. All this works fine. However, these pages open up other pages which may or may not open other pages etc.
I have tried to use ContentPage for the child pages and pass the rootpage Navigation property into them and use that to call Navigation.PushAsync I have also tried to make the pages navigation pages and then call Navigation.PushAsync on their own property: this throws some unhandled exception
Can anyone please help!
The root of each tab in your TabbedPage should be a single NavigationPage, which wraps a ContentPage. From that ContentPage you navigate to other pages by using the Navigation property of the page.