In my mobile application I would not like the home page to be back, because if you do that the person will return to the login screen. How do I remove this arrow from this page only?
In my mobile application I would not like the home page to be back, because if you do that the person will return to the login screen. How do I remove this arrow from this page only?
In XAML you can hide the button through AttachedProperty HasBackButton
of NavigationPage
like this:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:SeuNamespace.Views"
x:Class="SeuNamespace.Views.SuaPage"
NavigationPage.HasBackButton="False">
<!-- Conteúdo da sua página -->
</ContentPage>
In codebehind it would look like this:
namespace SeuNamespace.Views
{
public partial class SuaPage : ContentPage
{
public SuaPage()
{
InitializeComponent();
NavigationPage.SetHasBackButton(this, false);
}
}
}
Remember that there will always be a possibility for the user to use the hardware back button. In this case, you can treat by overwriting the corresponding event handler through the OnBackButtonPressed
method of the page by returning true
. So:
protected override bool OnBackButtonPressed()
{
// Alguma lógica de tratamento
return true;
}