如何在Xamarin中退出MasterDetail页面(或从中退出)到简单的ContentPage.形式? [英] How to Exit (or Navigate out of )a MasterDetail page to a simple ContentPage in Xamarin. Forms?

查看:350
本文介绍了如何在Xamarin中退出MasterDetail页面(或从中退出)到简单的ContentPage.形式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Xamarin.Forms应用程序,该应用程序具有以下内容:

I have a Xamarin.Forms app which has the following:

LoginPage - a ContentPage type
RegisterPage - a ContentPage type

parentMasterDetail - a MasterDetailPage type
masterPage - Master page (ContentPage type)
AppointmentPage - Detail page (ContentPage type)
NewAppointment - Detail  page (ContentPage type) 

我能够创建上面列出的所有页面的页面,但

I was able to create the pages all the pages as listed above, BUT

当我从详细信息"页面单击注销"按钮时, LoginPage会显示,但令我惊讶的是,它只是显示为详细信息页面, 好像它是详细信息页面之一,而菜单页面(即masterPage)仍然是 可从我的登录页面访问.这不是我想要的.

when I click on Logout button from the Detail page, the LoginPage displays but to my surprise it displayed just as a detail page, as if it is one of the detail pages and the menu page(i.e masterPage) is still accessible from my login page. This is not what I intended.

我要注销(即关闭)名为ParentMasterDetail的MasterDetailPage, 并导航到不属于MasterDetailPage的LoginPage,这样 在用户登录之前,无法访问masterPage(即菜单).

I want to logout of (i.e close) the MasterDetailPage, named parentMasterDetail, and navigate to the LoginPage which is not part of the MasterDetailPage such that the masterPage (i.e the menu) will not be accessible until user logs-in.

请,任何人都可以帮助我.

Please, anyone help me.

推荐答案

您可以执行以下操作:

Application.Current.MainPage = new NavigationPage(new LoginPage());

这篇关于如何在Xamarin中退出MasterDetail页面(或从中退出)到简单的ContentPage.形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆