Создание сводных нижних колонтитулов в приложении Windows Phone 7 - PullRequest
1 голос
/ 09 ноября 2011

Я знаю, что элемент управления сводкой Windows Phone состоит из двух частей: заголовков сводки и элемента управления сводкой.

я хочу отобразить заголовки сводки под элементом управления элементом сводки (или нижними колонтитулами).

Но я обнаружил, что эта штука недоступна в управлении сводкой.

Есть ли другой способ отображения вкладок в нижнем колонтитуле приложения wp7.

спасибо и с уважением

Ответы [ 2 ]

2 голосов
/ 09 ноября 2011

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

    <Style x:Key="PivotStyle" TargetType="controls:Pivot">
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Grid/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:Pivot">
                    <Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache" Grid.RowSpan="3"/>
                        <ContentPresenter ContentTemplate="{TemplateBinding TitleTemplate}" Content="{TemplateBinding Title}" Margin="24,17,0,-7"/>
                        <ItemsPresenter x:Name="PivotItemPresenter" Margin="{TemplateBinding Padding}" Grid.Row="1"/>
                        <controlsPrimitives:PivotHeadersControl x:Name="HeadersListElement" Grid.Row="2"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

<controls:Pivot Title="pivot" Style="{StaticResource PivotStyle}">

0 голосов
/ 09 ноября 2011

У меня есть решение. Вам необходимо унаследовать от Pivot строку управления и переключения заголовков со строкой элементов:

  public class PivotFooter : Pivot
  {
    public override void OnApplyTemplate()
    {
      base.OnApplyTemplate();

      var headers = base.GetTemplateChild("HeadersListElement") as PivotHeadersControl;
      var items = base.GetTemplateChild("PivotItemPresenter") as ItemsPresenter;

      var grid = headers.Parent as Grid;
      if(grid != null)
      {
        var firstHeight = grid.RowDefinitions[1].Height;
        var secondHeight = grid.RowDefinitions[2].Height;

        grid.RowDefinitions[1].Height = secondHeight;
        grid.RowDefinitions[2].Height = firstHeight;    
      }

      headers.SetValue(Grid.RowProperty, 2);
      items.SetValue(Grid.RowProperty, 1);
    }
  }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...