I'm currently evaluating RxUI for future projects and so far I like what I see.
I was able to create a first test project and navigate between pages using
HostScreen.Router.Navigate.Execute(new NewReleasesViewModel(HostScreen)).Subscribe();
Which creates a normal ContentPage with Backbutton.
I wonder how I can navigate to the ModalPage stack and display modal pages.
Related
I'm migrating our app from MvvmCross as we need to add Intune support and using MVX is preventing this.
The app is essentially an email reader, so currently we are using a MasterDetail page and loading a folder list into master which on phones becomes the flyout and on tablets this appears in the left of the split view.
When you select a folder from this page we then show a message list - this loads into the detail on phone, but for tablets we use MVX functionality to load this into master, this is also wrapped inside a nav page so you can go back to the folder list. Essentially we have a nav stack inside the master section on tablets and also one in the detail section.
I've checked and played around with the Prism samples, but they don't appear to cover this scenario. The documentation recommends only having fixed content in the master section and this is bound to the master detail view model. This is different to what we have currently, essentially we can control where any page ends up depending on idiom.
I would just like confirmation that it is possible for me to be able to load a page into detail or master depending on the device idiom and any examples would be greatly appreciated!
The Master property of the MasterDetailPage is a basic Page object so it does not have a navigation stack available but the property itself does have a getter and a setter so you should be able to set the page manually. We use a master page and as a quick test I was able to set it using:
((MasterDetailPage)Application.Current.MainPage).Master = new SwapMaster();
What might be possible that I didn't try is actually set the Master as a NavigationPage. Then you might be able to push onto the Master's navigation stack. Again, I did not try this ATM.
Update:
So I did play around quickly with setting the Master to a navigation page and then pushing and popping pages on and off the stack. It did work but the behavior was a little squirrelly but it does show it might be possible.
Push on the stack:
((NavigationPage)Master).Navigation.PushAsync(new SwapMasterPage());
Pop the stack:
((NavigationPage)((MasterDetailPage)Application.Current.MainPage).Master).Navigation.PopAsync();
I've answered this myself by taking a look in the source and there is no support in the Prism navigation service to load a page into master. Everything is overridable, but I feel it would result in lots of changes and issues if I try and introduce this concept.
We'll have to discuss internally if changing the UI flow on tablets is acceptable, if not then Prism is a no go and we'll look at alternatives or write our own navigation service to support it.
My application is using a tabbed page to separate 2 main areas. Using Xamarin.Forms 4.x and Prism.
The first tab basically hosts a set of linear navigated views modelling a workflow. It's been identified that when a user has progressed through the workflow, and accidentally taps on the current tab, the user is popped back to the start of the navigation.
Is there any way to bypass this event?
This only seems to happen on iOS.
I just discovered the answer. Works perfectly.
https://forums.xamarin.com/discussion/144478/ios-stop-tab-re-select-pop-to-navigation-page-root
I am implementing a feature using "connectivity" from essentials that when the app goes "offline" no wifi etc.. it navigates to a specific page.
It works in most cases however if I set the phone on "Airplane Mode" when I am on a modal page it does not navigate to my page.
In Prism is there a way to detect if the current page "IsModal" and either goback or kill it so that I can navigate to my specific Page?
THanks
You'd have to write some crazy lookup logic to figure it out. Unfortunately the helper for that doesn't currently exist. However the latest Prism 7.2 preview has some enhancements that specifically attempt to eliminate the need to figure out whether you require Modal Navigation and automatically use the proper type of Navigation. I would encourage you to try the preview. If you come up with a scenario where GoBack isn't working correctly please open an issue.
I want to implement a menu using a masterdetail page with caliburn.micro, but the only documentation i managed to find is this.
I know I have to use a NavigationPage inside MasterDetailPage.Detail and load my views into that, but I can't find any example of how MasterDetails composition works and how can I navigate from view to view (for example, for prism there's this).
Any help would be appreciated.
I am testing the deeplinking feature of the Prism Forms framework. I currently have a situation where I have a MasterDetailPage with a menu as Master. When I click the menu items, the Details should change to specific pages with a clean NavigationPage as container.
When I check the Sandbox example for Prism Forms, it shows an example for MasterDetail navigation, but not including navigation pages.
So I have this (absolute) deeplink structure at startup: /MasterDetailPage/NavigationPage/MyFirstPage
Then I want the second menu item to link to a fresh NavigationPage:
/MasterDetailPage/NavigationPage/MySecondPage
My current workaround is to do absolute deeplinking, but I was wondering if there is a better way? The Prism PageNavigationService checks to see if the segment type is the same as the current detail type. But since these are both NavigationPages, it tries to add the new page in the already existing NavigationPage. At that moment it also kills the menu-icon (at least on iOS).
Actually, the Sandbox app does use NavigationPages in the MasterDetail: https://github.com/PrismLibrary/Prism/blob/master/Sandbox/Xamarin/HelloWorld/HelloWorld/HelloWorld/Views/MyMasterDetail.xaml
Prism reuses the detail page for performance reasons, but it doesn't work like you think it does. While it does add the new page to the NavigationPage's NavigationStack, it also removes the previous page from the stack. This keeps the NavigationStack in the proper state.
The icon behavior you are seeing is because of a confirmed bug in Xamarin.Forms. You can follow the issue here: https://bugzilla.xamarin.com/show_bug.cgi?id=41038
As soon as Xamarin fixes this bug, I will publish the fix to Nuget. In the mean time, the only way to get around this is to fork the Prism code base and remove the Page type check.