jstuardo
jstuardo

Reputation: 4405

How to hide fly out menu button and how to navigate to the first page in MAUI

I developed a wizard control in MAUI whose content page is shown when user clicks an option in the fly out menu. Finally the last step of the wizard looks like this:

enter image description here

The Wizard page is displayed from the Shell menu, this way (in AppShell.xaml)

    <ShellContent
        Shell.NavBarIsVisible="true"
        Shell.TabBarIsVisible="false"
        Title="Enrolamiento"
        ContentTemplate="{DataTemplate views:EnrolamientoPage}"
        Route="EnrolamientoPage">
        <ShellContent.Icon>
            <FontImageSource FontFamily="FontAwesomeSolid" Glyph="{x:Static helpers:FontAwesomeIcons.User}" Color="Maroon" Size="50"/>
        </ShellContent.Icon>
    </ShellContent>

Please see the 3 lines shown by the red arrow. When wizard page is shown, I need that lines to be hidden (so, user cannot see fly out menu while in the wizard).

When the last step is reached, the "Finalizar" ("Finish") button shows the main page, this way:

await Shell.Current.GoToAsync(nameof(MainPage));

The problem with that is that when the MainPage is shown, the three lines of the fly out menu is replaced by the left arrow, so that user can go back.

How can I go to main page so that user can show the fly out menu instead of going back?

I was trying to get that information but I couldn't.

EDIT:

Here I am register MainPage route.

public partial class AppShell : Shell
{
    public AppShell()
    {
        InitializeComponent();

        Routing.RegisterRoute(nameof(MainPage), typeof(MainPage));
    }
}

Upvotes: 0

Views: 1814

Answers (1)

jstuardo
jstuardo

Reputation: 4405

Finally, in order to show the flyout menu lines, instead of the back arrow, I only needed to add // in front of the route, this way:

await Shell.Current.GoToAsync($"//{nameof(MainPage)}");

For the other problem, I could this this:

Shell.Current.FlyoutBehavior = Welcome.IsVisible ? FlyoutBehavior.Flyout : FlyoutBehavior.Disabled;

Upvotes: 1

Related Questions