Xamarin.Forms-从主页查看丢失的菜单

时间:2019-03-07 18:47:13

标签: c# xamarin xamarin.forms

我创建了一个运行良好的菜单,但是在某些未使用该菜单打开的页面上,该菜单替换为后退按钮。无论如何,是否要确保所有页面上都有菜单?

mainpage.xaml

<MasterDetailPage.Detail>
        <NavigationPage>
            <x:Arguments>
                <pages:HomePage />
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Detail>

Homepage.xaml.cs

 var masterDetailPage = Application.Current.MainPage as MasterDetailPage;
        masterDetailPage.Detail = new NavigationPage((new SearchPage("A")));

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:1)

通过替换详细信息部分替换了PushAsync

Navigation.PushAsync(new SearchPage("a"));    

var masterDetailPage = Application.Current.MainPage as MasterDetailPage;
masterDetailPage.Detail = new NavigationPage((new SearchPage("a")));