Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

364
Visualizações
MAUI project, cannot navigate to a new page

I've ran into a bug in MAUI and I just wanted to know if I'm the only one or if I'm doing something wrong in this new environment :)

Before I've always been able to do this when navigating to a new page via a button click:

private async void OnButtonClicked(object sender, EventArgs e)
       {
           await Navigation.PushAsync(new Page1());
       } 

But it does not seem to work anymore, this is how my Page1 looks like in C# code:

    public partial class Page1 : ContentPage
    {
        public Page1()
        {
           InitializeComponent();
        }

        protected override async void OnAppearing()
        {
            base.OnAppearing();

            await MainThread.InvokeOnMainThreadAsync(async () => { await LoadRecipes(); });
        }

        private async Task LoadRecipes() 
        {

           //no code yet
        }
    }
}

When I run this code and click the button, nothing happens.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can navigate using this in a ButtonClick or TapGestureRecongnizer.

private void TapGestureRecognizer_Tapped_2(object sender, EventArgs e)
    {
        App.Current.MainPage = new NavigationPage(new Page1());

    }

Or in a Button.

 private void Button_Clicked(object sender, EventArgs e)
    {
        App.Current.MainPage = new NavigationPage(new Page1());
    }
over 4 years ago · Santiago Trujillo Relatório

0

Try this: First in your App.xaml.cs

public partial class App : Application
{
    public App()
    {
        InitializeComponent();
        MainPage = new NavigationPage(new MainPage());
    }
}

Then in your MainPage you can do what you are attempiting to do:

private async void btnNav_Clicked(object sender, EventArgs e)
{
    await Navigation.PushAsync(new Page1());
}

This is supposed to work and to keep track of user's navigation, but in some weird scenarios im facing this is not working very well, but it's the solution that Microsoft documents on it's getting started guide. I would like to see more information in their Maui guide about navigation.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda