Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

356
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!