我想使用 Xamarin.Forms Shell 创建带有汉堡菜单的页面。该菜单将包含页面:HomePage(带有复杂构造函数)和AboutPage(带有默认构造函数)。AboutPage 没有问题,因为它可以在 xaml 中轻松创建,但我不知道如何使用 HomePage 添加新的 ShellItem
我尝试从 xaml.cs 创建此菜单项,但没有呈现。
AppShell.xaml.cs:
public AppShell(IDataProvider dataProvider)
{
InitializeComponent();
this.Items.Add(new ShellItem()
{
Title = "Home", Items = { new ShellSection()
{
CurrentItem = new ShellContent()
{
Content = new HomePage(dataProvider)
}
}}
});
}
那么如何使用 Xamarin Forms Shell 将页面与复杂构造器一起使用?如果可能的话,我什至更愿意从代码隐藏(xaml.cs)中执行此操作。感谢您的时间。
qq_花开花谢_0
相关分类