且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

漏洞?System.ArgumentException:'无法找出以下路线:

更新时间:2023-08-25 09:50:28

您需要使用 Shell.Current.GoToAsync()为愿意浏览的每个页面注册一个路由,并使用这样,您还可以阐明页面层次结构:

Your need to register a route for each page you are willing to navigate into it using Shell.Current.GoToAsync(), with this way you can also clarify your pages hierarchy:

    <FlyoutItem FlyoutDisplayOptions="AsMultipleItems">

        <ShellContent Title="RegisterPage"
                      Route="RegisterPage"
                      ContentTemplate="{DataTemplate local:RegisterPage}"/>

        <ShellContent Title="LoginPage"
                      Route="LoginPage"
                      ContentTemplate="{DataTemplate local:LoginPage}"/>

        <ShellContent Title="Page3"
                      ContentTemplate="{DataTemplate local:Page3}"/>

    </FlyoutItem>

如果愿意,还可以在代码中使用 Routing.RegisterRoute()注册路由,只要它在调用路由之前运行即可: Routing.RegisterRoute("//Page3",typeof(Page3));

You can also register the route using Routing.RegisterRoute() in the code if you prefer, as long as it runs before a route is invoked: Routing.RegisterRoute("//Page3", typeof(Page3));

更多详细信息: Shell导航