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?