我在我的 xamarin 應用程式應用程式中設計了一個選項卡視圖,我需要通過導航來控制它并顯示特定頁面,我默認將它放在第一頁并想要導航第二頁。
這是我的 TabView :
<Grid>
<xct:TabView
TabStripPlacement="Bottom"
TabStripBackgroundColor="White"
TabStripHeight="60"
TabIndicatorColor="#2196f3"
TabContentBackgroundColor="#2196f3">
<xct:TabViewItem
Icon="triangle.png"
Text="Patient Details"
TextColor="#2196f3"
TextColorSelected="#2196f3"
FontSize="12"
>
<Grid
BackgroundColor="Gray">
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent1" />
</Grid>
</xct:TabViewItem>
<xct:TabViewItem
Icon="circle.png"
Text="Patient Follows up"
TextColor="#2196f3"
TextColorSelected="#2196f3"
FontSize="12">
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent2" />
</Grid>
</xct:TabViewItem>
</xct:TabView>
</Grid>
uj5u.com熱心網友回復:
我們無法瀏覽里面的頁面TabView
。TabView
items 只接受視圖。之前已詢問過此問題,目前不支持此功能。
你可以Shell
改用。Shell
支持頁面的標簽。您可以使用路線導航到特定選項卡。
對于 中的選項卡Shell
,您可以Tabbar
直接使用或使用選項卡FlyoutItem
來實作與 Shell 中的 TabView 類似的功能。
注冊路線:
<Shell ...>
<FlyoutItem ...
Route="animals">
<Tab ...
Route="domestic">
<ShellContent ...
Route="cats" />
<ShellContent ...
Route="dogs" />
</Tab>
...
</Shell>
導航到貓頁面:
await Shell.Current.GoToAsync("//animals/domestic/cats");
有關更多詳細資訊,您可以參考 MS 檔案。https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/navigation
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/470495.html
標籤:C# xml xamarin xamarin.forms xamarin.android