1
我目前正在使用Xamarin Forms和Andoird工程(iOS支持将在稍后添加)。 该应用程序有MasterDetailPage
作为HomePage
和ToolBar
,它工作正常。Xamarin表单:复制主工具栏中的工具栏页面
在我的一个DetailPages
有一个ToolbarItem
链接到另一个页面:
Navigation.PushAsync(new NavigationPage(new ShoppingCartPage()));
当我在ShoppingCartPage
我有一个重复的工具栏,我不知道为什么(见ScreenshotPhone)
任何人都可以在正确的方向上指出我如何显示一个工具栏。 奇怪的是,ShoppingCartPage
上的ToolbarItem
显示两次。从ShoppingCartPage
XAML:从页面
<ContentPage.ToolbarItems>
<ToolbarItem x:Name="toolbarItemFinishOrder" Activated="FinishOrder" Icon="wallet_64.png">
</ToolbarItem>
</ContentPage.ToolbarItems>
<StackLayout>
XAML链接到ShoppingCartPage:
<ContentPage.ToolbarItems>
<ToolbarItem x:Name="toolbarItemShoppingCart" Activated="ShoppingCart_Clicked" Icon="shoppingCart2_64.png"></ToolbarItem>
</ContentPage.ToolbarItems>
</ContentPage>
代码从页面链接到ShoppingCartPage:
public partial class ArticleSearchPage : ContentPage
{
public ArticleSearchPage()
{
InitializeComponent();
this.Content = new ArticleSearchView();
//TODO: Localization
this.Title = "Artikel";
}
protected void ShoppingCart_Clicked(object sender, EventArgs e)
{
Navigation.PushAsync(new NavigationPage(new ShoppingCartPage()));
}
我希望我明确自己,并且能帮助我。 在此先感谢!
感谢您的回答。这解决了两个工具栏的问题,但现在我无法访问我的MasterDetail菜单。有没有办法做到这一点。如果没有,我可以用这个解决方案来生活。 –
在屏幕中间滑动手指以查看您是否出现主菜单。 –
如果我从左侧屏幕边框向中间滑动,出现菜单,我可以忍受。我只需向我的客户解释这一功能,但我认为工具栏中的其他按钮令人困惑。谢谢! –