2

The design of my app requires that I have a button in the Flyout Header, a separate view, which navigates to a page

Unlike the flyout items themselves though, when I click on the button, the page loads under the flyout header which stays open

Is there a way to have a button mimic exactly what happens when navigating within the flyout contents themselves?

The page I'm trying to navigate to is registered as a route in AppShell

The code in the view referenced in FlyoutHeader calls it from the button click like so

     await Shell.Current.GoToAsync("thepage");

As mentioned above the flyout menu is open at this point in order to access the button but when clicked it loads the desired page but I want it to automatically shut the menu

Is there a way to do this please?

Journeyman1234
  • 547
  • 4
  • 18

2 Answers2

5

As Ricardo says above.

You can use Shell.Current.FlyoutIsPresented = false;

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Journeyman1234
  • 547
  • 4
  • 18
2
 //===event click or command===
  
 private async void Button_Clicked(object sender, System.EventArgs e)
    {
        await Shell.Current.GoToAsync($"your others pages route");
        Shell.Current.FlyoutIsPresented = false;   
    }
Diego Venâncio
  • 5,698
  • 2
  • 49
  • 68