C# 在xamarin表单应用程序中获取2个标题栏

C# 在xamarin表单应用程序中获取2个标题栏,c#,visual-studio,xamarin,xamarin.forms,xamarin.android,C#,Visual Studio,Xamarin,Xamarin.forms,Xamarin.android,当我导航到另一个页面时,我的应用程序中有两个标题栏: 第一个包含后退按钮,第二个包含内容页的标题。我的问题是如何将它们合并到一个标题栏中。这是我的密码: 第1.cs页 await Navigation.PushAsync(new NavigationPage(new Page2())); 第2.xaml页 <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas

当我导航到另一个页面时,我的应用程序中有两个标题栏:

第一个包含后退按钮,第二个包含内容页的标题。我的问题是如何将它们合并到一个标题栏中。这是我的密码:

第1.cs页

await Navigation.PushAsync(new NavigationPage(new Page2()));
第2.xaml页

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="TestApp1.Page2" Title="Page 2">
    <ContentPage.Content>
        <StackLayout>
            <Label Text="Welcome to Xamarin Forms!" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>


对于应用程序中的第一个页面,添加一个新的
导航页面
,并在其中添加您的页面:

MainPage = new NavigationPage(new FirstPage());
对于第二个页面,不要创建新的
导航页面
,只需将新页面推到现有的
导航页面

await Navigation.PushAsync(new SecondPage());

对于应用程序中的第一个页面,添加一个新的
导航页面
,并在其中添加您的页面:

MainPage = new NavigationPage(new FirstPage());
对于第二个页面,不要创建新的
导航页面
,只需将新页面推到现有的
导航页面

await Navigation.PushAsync(new SecondPage());