1
votes

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?

2
You can use Shell.Current.FlyoutIsPresented = false;Ricardo Romo
Ricardo nailed it. See here.Andrew

2 Answers

1
votes

As Ricardo says above.

You can use Shell.Current.FlyoutIsPresented = false;

0
votes
 //===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;   
    }