I am currently working on a project in Xamarin Forms and Andoird (iOS support will be added later).
The app has a MasterDetailPage
as HomePage
and a ToolBar
, which works fine.
In one of my DetailPages
there is an ToolbarItem
that links to another Page:
Navigation.PushAsync(new NavigationPage(new ShoppingCartPage()));
When I am at the ShoppingCartPage
I got a duplicated Toolbar and I don't know why (see ScreenshotPhone)
Can anyone point me in the right direction on how to show just one toolbar.
The strange thing is, that the ToolbarItem
on the ShoppingCartPage
is shown twice.
XAML from ShoppingCartPage:
<ContentPage.ToolbarItems>
<ToolbarItem x:Name="toolbarItemFinishOrder" Activated="FinishOrder" Icon="wallet_64.png">
</ToolbarItem>
</ContentPage.ToolbarItems>
<StackLayout>
XAML from Page linking to ShoppingCartPage:
<ContentPage.ToolbarItems>
<ToolbarItem x:Name="toolbarItemShoppingCart" Activated="ShoppingCart_Clicked" Icon="shoppingCart2_64.png"></ToolbarItem>
</ContentPage.ToolbarItems>
</ContentPage>
Code from Page linking to 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()));
}
I hope that I made myself clear and that you can help me. Thanks in advance!
Use this to see:
Navigation.PushAsync(new ShoppingCartPage());