How to decrease the size of this navigation bar?

Asked

Viewed 190 times

1

I am doing this application and I needed to remove the arrow back, and after doing this removal the bar continued to exist, leaving the same very large and inelegant for my application... Can anyone tell me how to make it decrease? Below the image of how it is:

Here the mainpage code part:

[XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class MainPageRoot : MasterDetailPage
    {
        private ListView menu;
        private ObservableCollection<MasterPageItem> _menuLista;

        public MainPageRoot ()
        {
            InitializeComponent ();
            //menu = Master.navigationDrawerList;
            _menuLista = ItemService.GetMenuItens();
            navigationDrawerList.ItemsSource = _menuLista;
            Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(MainPage)));
           NavigationPage.SetHasBackButton(this, false);


        }

        private void OnMenuItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = (MasterPageItem)e.SelectedItem;
            Type pagina = item.TargetType;

            Detail = new NavigationPage((Page)Activator.CreateInstance(pagina));
            IsPresented = false;
        }
    }
}

Here’s my App.xaml.Cs file:

public partial class App : Application
{
    public App ()
    {
        InitializeComponent();

        MainPage = new NavigationPage(new LoginPage());
    }

    protected override void OnStart ()
    {
        // Handle when your app starts
    }

    protected override void OnSleep ()
    {
        // Handle when your app sleeps
    }

    protected override void OnResume ()
    {
        // Handle when your app resumes
    }
}

inserir a descrição da imagem aqui

  • 1

    In fact, probably what’s happening there is that you have a Masterdetailpage inside a Navigationpage. Share the page creation code and where you set the App Mainpage so we can help.

  • I’ll edit the question by entering the code!!

  • In this file I only have this <?xml version="1.0" encoding="utf-8" here? > <Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Ebshelpdesk.App"> <Application.Resources> <! -- Application Resource Dictionary --> </Application.Resources> </Application>

  • @Diegorafaelsouza sorry, it was dreamy of me... but, I edited take a look!

1 answer

1


Just take out the Navigationpage that is encapsulating your Masterdetailpage.

Somewhere after login you must be doing something like this:

// Dentro da página do login ou da view model de login você deve estar empilhando uma nova página na navigation do login.
this.Navigation.PushAsync(new MainPageRoot());

Change that code to something like this:

App.Current.MainPage = new MainPageRoot();

I hope it works.

  • perfect guy, that’s right... thank you so much for the help!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.