Master Detail Page Back Button

LeeGwangYongLeeGwangYong USMember ✭✭
edited July 2017 in Xamarin.Forms

At first, I made my project using this site
And i can navigate ohter pages through master(hamburger menu)

This is my question.
If i tapped a row of datagrid at ClientPage, it will navigate to ClientDetailPage.
And i can return ClientPage by clicked Navigation Back Button, But!! Hambuger menu icon is disappeared...

//MainPage.xaml
public MainPage()
{
InitializeComponent();
IsPresented = false;
menuList = new List();

            var page1 = new MasterPageItem() { Title = "Client Management", Icon = "ic_import_contacts_black.png", TargetType = typeof(CleintManagementView) };
            var page2 = new MasterPageItem() { Title = "WOD Management", Icon = "", TargetType = typeof(WODManagementView) };
            var page3 = new MasterPageItem() { Title = "Statics", Icon = "", TargetType = typeof(Statics) };

            menuList.Add(page1);
            menuList.Add(page2);
            menuList.Add(page3);

            MenuList.ItemsSource = menuList;
            Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(CleintManagementView)));
}
        #region MasterDetail MenuList Selected
        private void MenuList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = (MasterPageItem)e.SelectedItem;
            Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
           IsPresented = false;
        }

//ClientPage
private void dataGrid_GridDoubleTapped(object sender, Syncfusion.SfDataGrid.XForms.GridDoubleTappedEventsArgs e)
{
var masterDetail = App.Current.MainPage as MasterDetailPage;
var nav = new NavigationPage();

            var nextPage = new ClientManagementDetailView();
            var selected = e.RowData as People;
            nextPage.BindingContext = selected;
            nextPage.PassContext();
            masterDetail.Detail.Navigation.PushAsync(nextPage);
        }

ClientPage

ClientPage->Double Tapped->ClientDetailPage

Hamburger menu is disappeared..

Best Answer

Answers

  • LeeGwangYongLeeGwangYong USMember ✭✭
    edited July 2017

    @Sumit_Sharma oh this code is good for me.
    but it didn't work about hamburger menu.
    Thank you for your comment

    when i deploy and play at android, it is work. But, I need UWP platform!! :neutral:

  • Sumit_SharmaSumit_Sharma USMember ✭✭✭

    @LeeGwangYong Did it worked ??

    Can you explain what was the problem and what is the solution.

    Thanks
    Sumit Sharma

  • LeeGwangYongLeeGwangYong USMember ✭✭

    @Sumit_Sharma
    hmm.. When i pressed back button, Hamburger menu is appeared at android platform, but disappeared at UWP platform!
    i give up this error..

  • DhruDhru INMember

    Try this:

    App.Current.MainPage = new MainPage { Detail = new NavigationPage(new pagename()) };

    where pagename is the page that you want to navigate to.

    Hope this helps!

    Regards,
    Dhru

  • Sean.AndersonSean.Anderson USMember ✭✭

    This was happening to me as well. After tearing my application apart several times over two days I finally discovered it was because my detail page did not have a title. Yeah.

    Passing in a NavigationPage with my detail page (ContentPage) as the parameter, I would then call Navigation.PopAsync(new MoreDetailPage()). Everything was great until I hit back, and then my hamburger button would disappear when it popped back to the original detail page. I added a title to the first detail page and the icon remained each time.

  • TharkasTharkas Member

    Had the same issue as Sean. After two days of trying various things, it never crossed my mine to put a title on the detail page. Once I did, hamburger button remained.

Sign In or Register to comment.