Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide PivotItem Header?

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?

like image 923
Alex Avatar asked Nov 04 '11 11:11

Alex


2 Answers

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.

like image 164
Heinrich Ulbricht Avatar answered Oct 23 '22 05:10

Heinrich Ulbricht


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>
like image 43
maxdelia Avatar answered Oct 23 '22 04:10

maxdelia