简体   繁体   English

Xamarin.Forms中的MasterDetailsPage标题和详细信息布局

[英]MasterDetailsPage header and details layout in Xamarin.Forms

link to mockup layout 链接到样机布局

In Xamarin.Forms, we have MasterDetailsPage, but is it possible to layout as a header and master details page were the master details content only changes when navigating but not the header? 在Xamarin.Forms中,我们有MasterDetailsPage,但是可以布局为标题和主要详细信息页面,主要细节内容仅在导航时更改而不是标题? I have an app that has a header that has a special function after being pressed by x seconds, doing the in every page is not a good idea. 我有一个应用程序有一个标题,在按下x秒后有一个特殊的功能,在每个页面做这个不是一个好主意。 So I am looking for a solution that a MasterDetailsPage can have a header instead of the side menu and a Detail panel. 所以我正在寻找一个解决方案,MasterDetailsPage可以有一个标题而不是侧面菜单和一个Detail面板。

Xamarin Forms NavigationPage是否适合您的尝试?

I got it.. NavigationPage is not really what I want because I need a way to customize the header as well and have an addition function. 我明白了.. NavigationPage并不是我想要的,因为我需要一种方法来自定义标题并具有附加功能。 In UWP, we have Frame. 在UWP中,我们有Frame。 Luckily Frame works too in Xamarin. 幸运的是,框架在Xamarin也是如此。

So here's the screenshot 所以这是截图 在此输入图像描述

Here's how to get the other page in a Frame 以下是如何在Frame中获取其他页面

public partial class MainPage : ContentPage
{
    public MainPage()
    {
        InitializeComponent();

        this.FrameNav.Content = (new Page_Home()).Content;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM