Xamarin表单:MasterDetailPage:详细页面是否必须是NavigationPage作为标准

时间:2016-11-04 12:11:36

标签: xamarin navigation-drawer master-detail

在Xamarin网站的示例代码中,详细信息页面已添加到NavigationPage

Detail = new NavigationPage(new TestPage());

TestPage必须由NavigationPage包装吗?如果我删除NavigationPage并只放new TestPage(),它将对我有用。如果我保留NavigationPage,我会在这里发布错误。

Reference from my other post

如果没有NavigationPage,汉堡包图标将会消失,即使仍然能够显示母版页。

1 个答案:

答案 0 :(得分:0)

From official Xamarin documentation:

Public Constructors

NavigationPage()
Initializes a new NavigationPage object.

NavigationPage(Page) 
Creates a new NavigationPage element with root as its root element.

因此,如果要指定它是根元素,则只需要/希望/必须将页面作为参数传递。

如果您使用MasterDetailPage开发UWP应用程序,您应该记住:

Generally, you'll set these two properties to objects of type ContentPage, but currently, to get MasterDetailPage to work on the Universal Windows Platform, the detail page must be a NavigationPage.