[英]Getting 2 title bar in xamarin forms app
當我導航到另一個頁面時,我的應用程序中有兩個標題欄:
第一個包含返回按鈕,第二個包含內容頁面的標題。 我的問題是如何將它們合並到單個標題欄中。 這是我的代碼:
Page1.cs
await Navigation.PushAsync(new NavigationPage(new Page2()));
Page2.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>
在應用程序的第一頁中,添加一個新的NavigationPage
並在其中添加您的頁面:
MainPage = new NavigationPage(new FirstPage());
對於第二頁,不要創建新的NavigationPage
,只需將新頁面推到現有的NavigationPage
:
await Navigation.PushAsync(new SecondPage());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.