Menu burger hiding when calling a new view Xamarin Forms

0

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

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

I have already used PushModalAsync and PushAsync but continue this way.

How can I fix this issue?

    
asked by anonymous 09.01.2017 / 17:29

1 answer

2

Using the MessagingSender in xamarin we can do a detailpagechanged navigation that keeps the menu in place of 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");
    }
    
11.01.2017 / 01:34