Windows Phone - сводная и родительская страница - PullRequest
1 голос
/ 09 апреля 2011

У меня есть PivotControl внутри страницы приложения PPhone. В идеале я хотел бы всегда показывать элементы панели приложения со страницы и объединять их с элементами, определенными в UserControl, который отображается в каждом PivotItem. Я пробовал несколько разных вещей, но только внешняя (PhoneApplicationPage) панель приложения, кажется, показывает.

Ответы [ 2 ]

1 голос
/ 07 ноября 2013

Вы можете использовать разные панели приложений для каждого элемента сводки в сводке. попробуйте код ниже

<phone:Pivot>
    <i:Interaction.Triggers>
        <appBarUtils:SelectedPivotItemChangedTrigger>
            <appBarUtils:SelectedPivotItemChangedTrigger.SelectionMappings>
                <appBarUtils:SelectionMapping SourceIndex="0" TargetIndex="0"/>
            </appBarUtils:SelectedPivotItemChangedTrigger.SelectionMappings>

            <appBarUtils:SwitchAppBarAction>
                <appBarUtils:AppBar Id="0"   BackgroundColor="{StaticResource AppBarBg}" ForegroundColor="{StaticResource Foreground}">
                    <appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.home.png" Text="home" Command="{Binding HomeNavigationCommand}"/>
                </appBarUtils:AppBar>

                <appBarUtils:AppBar Id="1" BackgroundColor="{StaticResource AppBarBg}" ForegroundColor="{StaticResource Foreground}">
                    <appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.home.png" Text="home" Command="{Binding HomeNavigationCommand}"/>
                </appBarUtils:AppBar>

                <appBarUtils:AppBar Id="2" BackgroundColor="{StaticResource AppBarBg}" ForegroundColor="{StaticResource Foreground}">
                    <appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.home.png" Text="home" Command="{Binding HomeNavigationCommand}"/>
                    <appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.money.png" Text="collection" Command="{Binding CollectionPageCommand}"/>
                    <appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.check.rest.png" Text="ok" Command="{Binding OrderConfirmationButtonCommand}"/>
                </appBarUtils:AppBar>

                <appBarUtils:AppBar Id="3"  BackgroundColor="{StaticResource AppBarBg}" ForegroundColor="{StaticResource Foreground}">
                    <appBarUtils:AppBarButton x:Name="ConfirmationAppBarButton" IconUri="/Assets\Images\appbar.cancel.rest.png" Text="cancel" Command="{Binding OrderCancelButtonCommand}"/>
                    <appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.check.rest.png" Text="ok" Command="{Binding OrderConfirmationButtonCommand}" IsEnabled="{Binding Model.EnableCheck,Mode=TwoWay}" />
                </appBarUtils:AppBar>

            </appBarUtils:SwitchAppBarAction>
        </appBarUtils:SelectedPivotItemChangedTrigger>
    </i:Interaction.Triggers>
</phone:Pivot>
1 голос
/ 09 апреля 2011

Элементы AppBar принадлежат странице, а не сводным элементам.Но вы можете добавлять / удалять затем динамически по мере необходимости:

Ваша страница имеет свойство ApplicationBar, которое имеет свойство Buttons и MenuItems.Добавляйте и удаляйте кнопки / элементы меню программно по мере необходимости, когда выбирается новый PivotItem.

...