Shell.TitleView 覆盖了我在 .Net Maui 中的 NavigationPage 选项卡

问题描述 投票:0回答:1

因此,对于客户端,我们在 appshell.xml 的顶部设置了一组按钮:

 <Shell.TitleView>

     <Grid ColumnDefinitions="*, Auto">
         <HorizontalStackLayout Grid.Column="1">
             <Button Text="User Info"
         FontSize="Micro"
         VerticalOptions="Center"
         ImageSource="icon_user.png"
         MaximumHeightRequest="75"
         ContentLayout= "left,1"
         Clicked="User_Info_Button_Clicked"
 />
             <Button Text="In-Progress"
         FontSize="Micro"
         VerticalOptions="Center"
         ImageSource="icon_view_in_progress_pso.png"
         MaximumHeightRequest="75"
         ContentLayout= "left,1"
         Clicked="InProgressPSO_Button_Clicked"
 />
             <Button Text="User Settings"
         FontSize="Micro"
         VerticalOptions="Center"
         ImageSource="icon_settings.png"
         MaximumHeightRequest="75"
         ContentLayout= "left,1"
         Clicked="Settings_Button_Clicked"
         />
             <Button Text="Logout"
         FontSize="Micro"
         VerticalOptions="Center"
         ImageSource="logout.png"
         MaximumHeightRequest="75"
         ContentLayout= "left,1"
         Clicked="Logout_Button_Clicked"
 />

         </HorizontalStackLayout>
     </Grid>
 </Shell.TitleView>
 <ShellContent x:Name="ShellWindow"/>

看起来像这样:

这也与我的带有两个页面的选项卡有关: 日志页面和报告页面

每当我使用

Shell.Current.GotoAsync(nameof(Pagetogoto))
我们离开导航页面,然后使用以下任一方法:
Shell.Current.GoToAsync(nameof(MainPage))
Shell.Current.GoToAsync($"../nameof(MainPage))
我的 AppShell 中的按钮覆盖了我主页上的选项卡。

还有一个问题是,每当我导航时,更多 MainPage 实例都会被推送到导航堆栈上。我该如何维持这个?

.net windows mobile maui
1个回答
0
投票

问题是 shell 和选项卡式页面不能很好地相处。我们选择不使用 APPShell,我已将工具栏放在 NavigationPage.TitleView 中

© www.soinside.com 2019 - 2024. All rights reserved.