簡體   English   中英

Xamarin.Forms - 如何導航到選項卡式頁面子頁面

[英]Xamarin.Forms - How to navigate to a tabbed page child page

我對 Xamarin.Forms 和一般的應用程序構建還是很陌生,所以請保持溫和。

目前我正在使用標簽頁來處理我的主導航,一旦用戶登錄,我就有 3 個標簽。其中一個標簽稱為“AccountPage”。 從帳戶頁面,您可以轉到個人資料頁面並更新個人資料信息。 用戶完成更新配置文件信息並保存后,我當前執行 Navigation.PushAsync 返回帳戶頁面。

我想要做的實際上是讓它導航回主選項卡頁面,但顯示帳戶子頁面......如果這有意義的話。 基本上我希望顯示帳戶頁面,但也顯示用於導航的選項卡(目前沒有,因為我只是直接導航到帳戶頁面)。

有沒有辦法導航到標簽頁孩子? 就像是

Navigation.PushAsync(new TabbedPage().Child(new AccountPage()))

如果我理解正確,您可以將選項卡式子頁面包裝到NavigationPage ,例如:

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:TabbedPageWithNavigationPage;assembly=TabbedPageWithNavigationPage" x:Class="TabbedPageWithNavigationPage.MainPage">
  <NavigationPage Title="Schedule" IconImageSource="schedule.png">
    <x:Arguments>
        <local:AccountPage />
    </x:Arguments>
  </NavigationPage>
  <local:TodayPage />
  <local:SettingsPage />
</TabbedPage>

然后您可以通過以下代碼轉到頁面ProfilePage

await Navigation.PushAsync (new ProfilePage());

並使用代碼返回AccountPage

 await Navigation.PopAsync ();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM