Xamarin.forms 登录用户并导航回主页Shell

Xamarin.forms 登录用户并导航回主页Shell,xamarin.forms,Xamarin.forms,我在Xamarin表单应用程序中使用Shell, 我有一个问题,当我的用户注册成功时,他被重定向到主页,但底部没有选项卡菜单,而如果我将他重定向到AppShell,页面是空白的。你有什么建议吗 我的重定向 await App.Current.MainPage.Navigation.PushModalAsync(new AppShell()); 我的AppShell <TabBar > <Tab x:Name="HomePage" Icon="home.png

我在Xamarin表单应用程序中使用Shell, 我有一个问题,当我的用户注册成功时,他被重定向到主页,但底部没有选项卡菜单,而如果我将他重定向到AppShell,页面是空白的。你有什么建议吗

我的重定向

await App.Current.MainPage.Navigation.PushModalAsync(new AppShell());
我的AppShell

<TabBar >
        <Tab  x:Name="HomePage" Icon="home.png" Title="{x:Static resources:AppResources.LabelHome}" >
            <ShellContent ContentTemplate="{DataTemplate views:HomePage}"/>
        </Tab>
        <Tab  x:Name="Categories" Icon="collections.png " Title="{x:Static resources:AppResources.LabelCategory}">
            <ShellContent ContentTemplate="{DataTemplate views:CategoriesPage}"/>
        </Tab>
        <Tab  x:Name="Add" Icon="add.png" Title="{x:Static resources:AppResources.LabelAddingPage}">
            <ShellContent ContentTemplate="{DataTemplate views:AddingPage}"/>
        </Tab>
        <Tab  x:Name="Inbox" Icon="mail.png" Title="{x:Static resources:AppResources.LabelInbox}" >
            <ShellContent ContentTemplate="{DataTemplate views:InboxPage}"/>
        </Tab>
        <Tab  x:Name="Profile" Icon="userg.png" Title="{x:Static resources:AppResources.LabelProfil}">
            <ShellContent ContentTemplate="{DataTemplate views:UserProfilePage}"/>
        </Tab>
    </TabBar>

您必须进行以下更改:-

  • 您的重定向应该是:-

        await Shell.Current.GoToAsync("//main");
    
  • 您的应用程序外壳应具有以下内容:-

    <TabBar Route="main">
    ...   
    </TabBar>
    
    
    ...   
    

  • 希望这会有所帮助。

    您必须进行以下更改:-

  • 您的重定向应该是:-

        await Shell.Current.GoToAsync("//main");
    
  • 您的应用程序外壳应具有以下内容:-

    <TabBar Route="main">
    ...   
    </TabBar>
    
    
    ...   
    

  • 希望这能有所帮助。

    通过重定向
    等待App.Current.MainPage.Navigation.PushModalAsync(new-AppShell()),我想您有另一个Shell应用程序只用于登录

    尝试等待App.Current.MainPage=new AppShell()
    将Shell初始化为主页面


    希望这有帮助;)

    从重定向
    等待App.Current.MainPage.Navigation.PushModalAsync(new-AppShell()),我想您有另一个Shell应用程序只用于登录

    尝试等待App.Current.MainPage=new AppShell()
    将Shell初始化为主页面

    希望这有帮助;)