Xamarin TabbedPage with different ToolbarItems for each ContentPage

495 views Asked by At

I need to have different ToolbarItems for each ContentPage that are inside the main TabbedPage.

I have tried with:

<TabbedPage 
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="SgatMobileV2.Views.DettaglioWoView"
    Title="{Binding Title}"
    x:Name="DettaglioWoPage"
    xmlns:core="clr-namespace:SgatMobileV2.Core;assembly=SgatMobileV2"
    core:ViewModelLocator.AutoWireViewModel="true">

    <ContentPage Title="**Guasti" BindingContext="{Binding .}">
        <ContentPage.ToolbarItems>
            <ToolbarItem Name="Item1" Order="Primary"  Text="{core:Translate I1}" Priority="0" />
            <ToolbarItem Name="Item2" Order="Primary"  Text="{core:Translate I2}" Priority="0" />
        </ContentPage.ToolbarItems>
        <StackLayout>
            <BoxView Color="Purple" VerticalOptions="FillAndExpand" />
        </StackLayout>
    </ContentPage>

    <ContentPage Title="**CheckList" BindingContext="{Binding .}">
        <ContentPage.ToolbarItems>
            <ToolbarItem Name="Item3" Order="Primary"  Text="{core:Translate I3}" Priority="0" />
            <ToolbarItem Name="Item4" Order="Primary"  Text="{core:Translate I4}" Priority="0" />
        </ContentPage.ToolbarItems>
        <StackLayout>
            <BoxView Color="Orange" VerticalOptions="FillAndExpand" />
        </StackLayout>
    </ContentPage>

But this doesn't works.

How can I archive this?

0

There are 0 answers