I wish to have a Pivot control that has PivotItems but no pivot item Header text in landscape (it's a gallery in landscape mode, when reverted to portrait it should display the PivotItems header again).
The solution to make the text PivotItem.Header = ""
is not good since the space occupied by the header text is still reserved (so there's a blank space that is not used).
How can I do so?
You can set the top Margin
of your pivot items to a negative value to move them up:
<controls:PivotItem Header="item1" Margin="0,-100,0,0">
It doesn't remove the header, but your gallery items will be on top of it and thus have more space available. Combine this with your idea of clearing the captions and you could have a solution.
A more elegant solution: just override the deafult HeaderTemplate with a non-visibile (but NOT collapsed) DataTemplate:
<controls:Pivot.HeaderTemplate>
<DataTemplate>
<StackPanel Height="0" Width="0">
<TextBlock Text="{Binding}" />
</StackPanel>
</DataTemplate>
</controls:Pivot.HeaderTemplate>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With