Xamarin TabbedPage为每个ContentPage使用不同的ToolbarItems

时间:2017-12-01 17:19:48

标签: c# xaml xamarin tabbedpage toolbaritems

我需要为主TabbedPage中的每个ContentPage使用不同的ToolbarItem。

我尝试过:

<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>

但这不起作用。

我如何存档?

0 个答案:

没有答案