如何解决从 Contentpage 导航到 TabbedPage
我有一个包含项目列表的内容页面。 然后我有一个 TabbedPage 表示拆分的这些项目之一(每个选项卡代表项目的一部分..类别、句点等)
现在,我想单击列表中的项目 (contentPage) 并导航到该项目 (TabbedPage)。
我尝试使用 Navigation.PushAsync,它在 IOS 上对我来说很好用,但是在 Android 上我有一个例外:
system.invalidCastException: 'Specified cast is not valid.'
public partial class BudgetsPage : ContentPage
{
//...
async void OnItemSelected(object sender,EventArgs args)
{
var layout = (BindableObject)sender;
var item = (BudgetItem)layout.BindingContext;
var budgetManagement = new BudgetManagementPage(new BudgetDetailviewmodel(item));
await Navigation.PushAsync(budgetManagement);
}
}
标签页类似于
public partial class BudgetManagementPage : TabbedPage
{
public BudgetManagementPage(BudgetDetailviewmodel viewmodel)
{
InitializeComponent();
budgetManagementPage.Children.Add(new NavigationPage(new BudgetInfoTab(viewmodel)) { IconImageSource = GetimageSource(IconFont.information),Title="Info"});
}
private ImageSource GetimageSource(string iconName)
{
return new FontimageSource()
{
FontFamily = "materialWebFont",Glyph = iconName
};
}
}
不知何故,Android 似乎并不期待 pushAsync 上的标签页?
有人遇到同样的问题吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。