最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

.net MAUI: How to cover the TabBar when navigating to other pages - Stack Overflow

programmeradmin2浏览0评论

AppShell.xaml

<TabBar x:Name="tabBar">
        <Tab x:Name="tabCheck" Title="News" Route="CheckPage">
            <ShellContent
                ContentTemplate="{DataTemplate local:MainPage}"
                />
        </Tab>

        <Tab x:Name="tabSearch" Title="Search">
            <ShellContent
                ContentTemplate="{DataTemplate pages:SearchPage}"
                Route="SearchPage"/>
        </Tab>
</TabBar>

AppShell.xaml.cs

Routing.RegisterRoute("DetailPage", typeof(Pages.DetailPage));

In MainPage, if I navigate to DetailPage using the following method.

Shell.Current.GoToAsync("CheckResultPage", ...);

Then the newly opened page will be opened in the TabBar, that is, the bottom of the TabBar will not be covered by the new page. This is not in line with the normal experience.

If use the following method:

<TabBar x:Name="tabBar">
        <Tab x:Name="tabCheck" Title="News" Route="CheckPage">
            <ShellContent
                ContentTemplate="{DataTemplate local:MainPage}"
                />
        </Tab>

        <Tab x:Name="tabSearch" Title="Search">
            <ShellContent
                ContentTemplate="{DataTemplate pages:SearchPage}"
                Route="SearchPage"/>
        </Tab>
</TabBar>

<ShellContent
            ContentTemplate="{DataTemplate pages:DetailPage}"
            Route="DetailPage"/>
Shell.Current.GoToAsync("//CheckResultPage", ...);

Then the new page will be opened as a pop-up instead of sliding in from right to left, and there will be no back button in the upper left corner.

I want to open a new page in a very common way, that is, sliding in from right to left and covering the TabBar.

I don't want to use Shell.Current.Navigation.PushAsync because I need to use dependency injection.

I also don’t want to use TabBarIsVisible, because the effect of “hide” is very different from the effect of “cover”, which will make users feel very clearly that the TabBar is hidden, and the experience is very bad.

What is the best way for me to proceed?

发布评论

评论列表(0)

  1. 暂无评论