1
在上一個問題How to Change Pivot Header Template in Windows Phone 8我重新設計了數據透視表頭,但我想知道如何在維護PivotControl功能的同時將所有標頭一起移除。如何刪除數據透視表頭,但保持功能
在上一個問題How to Change Pivot Header Template in Windows Phone 8我重新設計了數據透視表頭,但我想知道如何在維護PivotControl功能的同時將所有標頭一起移除。如何刪除數據透視表頭,但保持功能
下面是我使用的爲同一目的的解決方案,它工作正常:
<phone:PhoneApplicationPage.Resources>
<Style x:Key="PivotStyle1" TargetType="phone:Pivot">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:Pivot">
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
<primitives:PivotHeadersControl x:Name="HeadersListElement" />
<ItemsPresenter x:Name="PivotItemPresenter" Margin="{TemplateBinding Padding}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PivotItemStyle1" TargetType="phone:PivotItem">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
</Style>
</phone:PhoneApplicationPage.Resources>
<phone:Pivot x:Name="MyPivot"
Style="{StaticResource PivotStyle1}" ItemContainerStyle="{StaticResource PivotItemStyle1}">
<phone:Pivot.ItemTemplate>
<DataTemplate><!-- dummy content to show that no header is on the screen -->
<Border BorderBrush="Blue" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid Background="Red" />
</Border>
</DataTemplate>
</phone:Pivot.ItemTemplate>
<!-- we need empty header template to hide the pivotitem title completely -->
<phone:Pivot.HeaderTemplate>
<DataTemplate />
</phone:Pivot.HeaderTemplate>
</phone:Pivot>
您可以設置爲空白作爲一個快速的解決方法就像這裏顯示; http://stackoverflow.com/questions/19139001/windows-phone-8-remove-pivot-header –
用戶如何設想知道沒有標題的其他「標籤/頁面」? –