Burger menu hiding when calling a new view Xamarin Forms

Asked

Viewed 136 times

0

I have a View which is being called through a button of the MenuItem. But within those View contains another button that calls a new button View. This new View opens off the burger menu, ie it hides itself.

I need this new View continue displaying the menu just above as in the first image.

I’ve used the PushModalAsync and the PushAsync but continues that way.

How to fix this navigation problem ?

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • I think your 'Viewprincipal (root navigation) deve do tipoMaster-Detail` she’s already that type?.

  • That is @rubStackOverflow

1 answer

2

Using Messagingsender in Xamarin we can make a navigation detailpagechanged that keeps the menu instead of queued navigation (push and pop) .

        MessagingCenter.Subscribe<Page>(this, "DetailPageChanged", (page) =>
        {
            DetailPageChanged(page);
        });

    private void DetailPageChanged(Page page)
    {
        var currentDetailPage = Detail as HoldingPage;
        if (currentDetailPage != null)
        {
            var internalPage = currentDetailPage.CurrentPage as IDisposable;
            if (internalPage != null)
            {
                internalPage.Dispose();
            }
        }

        var holdingPage = new HoldingPage();

        holdingPage.PopAsync();

        holdingPage.PushAsync(page);
        Detail = holdingPage;
    }

You can create a Helper and call the method this way :

    public static void SendDetailPageChanged(Page detailPage)
    {
        MessagingCenter.Send<Page>(detailPage, "DetailPageChanged");
    }
  • is it necessary to create the Helper or can you do it the first way you posted ? And where exactly I create this Detailpagechanged call ?

  • The Ideal is you create in your Menupage. Understand the first method is to register to listen to that event of "Detailpagechanged". the second method is the page change you should perform. the third is a helper to facilitate your call

Browser other questions tagged

You are not signed in. Login or sign up in order to post.