问题描述
我有一个包含项目列表的内容页面。 然后我有一个 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 (将#修改为@)