Forum Xamarin Xamarin.Forms

How to close the Flyout menu of a Shell in Xamarin Forms programmatically?

toyinstoyins USMember ✭✭✭

I have created a shell with menu items. However, I want to navigate to a page outside of the shell from a button click on that page. When I'm on the button to navigate to the other page, the flyout menu does not close automatically? How do I close the flyout menu programmicatically when I click on the button?

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    We can use Shell.FlyoutIsPresented to control the visible status of the Shell Flyout , set it false after navigate to other page .

        private async void Button_Clicked(object sender, System.EventArgs e)
        {
            await Shell.Current.GoToAsync($"//xxxx");
            Shell.Current.FlyoutIsPresented = false;   //close the menu 
        }
    
Sign In or Register to comment.