【发布时间】:2021-10-27 21:25:30
【问题描述】:
我正在尝试更改我的 MainPage,根据我的 RadioButton Group 中标记的页面,在我的设置中。因此,如果标记第一个将是“APage”,否则为“BPage”。
但是当我尝试更改MainPage = new AppShell(); 时,它只是忽略并且不要转到另一个页面。
我的标准 MainPage 注册为:
<ShellContent Title="{x:Static resource:AppResources.home}" Icon="home_icon.png" Route="MainPage" ContentTemplate="{DataTemplate local:MainPage}" />,但我尝试删除此Route 并执行以下操作:
DatabaseAccess DAO = new DatabaseAccess();
if (Convert.ToInt32(DAO.GetRadioValue()[0].RadioButtonValue) == 1)
category.Route = "MainPage";
else
home.Route = "MainPage";
但它仍然不起作用。
即使我转到标准 MainPage 的代码隐藏并输入 Shell.Current.GoToAsync(nameof(CategoryPage)); 什么也不做。
有什么想法吗?
【问题讨论】:
标签: xamarin.forms routes xamarin.forms.shell app-shell