Reputation: 63
I have a Xamarin Forms application, which has 2 buttons on the toolbar. Currently I'm using FreshMVVM (and it's navigation). I want to load pages without putting them into the navigation. I do not want to have the 'back' button on the toolbar, also I do not want the user return the last page.
Here's how I push a page currently:
CoreMethods.PushPageModel<FirstChoicePageModel>();
I tried to push as a modal, but that way the toolbar buttons does not work until I press back. Should I make new navigation containers and switch to them if I push the buttons?
Upvotes: 0
Views: 522
Reputation: 1438
It's been a little while since I've used FreshMVVM, but if I recall correctly, you have 2 options:
CoreMethods.PushPageModelWithNewNavigation<FirstChoicePageModel>();
NavigationPage.SetHasBackButton(this, false);
in the code behind of the view.For both of these options, it may necessary to intercept the back button on Android. In the code behind there is an overrideable method:
protected override bool OnBackButtonPressed()
{
return true; // prevent Xamarin.Forms from processing back button
}
Upvotes: 1
Reputation:
If you want to show a page, but you doesn't want to navigate (change the current page), you can always use Popups.
See this link https://github.com/rotorgames/Rg.Plugins.Popup
Upvotes: 1