且构网

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

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

更新时间:2023-08-25 09:42:10

您需要使用 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));

更多详情:外壳导航