2016-04-15 30 views
0

透視顯示我已經改變了樞軸控件的默認樣式:只有字體後標題的部分調整

<PivotHeaderPanel x:Name="StaticHeader" Height="200" Visibility="Collapsed"/> 
     <PivotHeaderPanel x:Name="Header"> 
       <PivotHeaderPanel.RenderTransform> 
        <TransformGroup> 
         <CompositeTransform x:Name="HeaderTranslateTransform"/> 
         <CompositeTransform x:Name="HeaderOffsetTranslateTransform"/> 
        </TransformGroup> 
     </PivotHeaderPanel.RenderTransform> 
</PivotHeaderPanel> 

,並通過設置我的頭:

<PivotItem.Header> 
        <TextBlock Height="77" FontSize="51">Mouse Support</TextBlock> 
</PivotItem.Header> 

,但顯示的標題心不是正確: enter image description here

如何解決這個問題?

+0

給TextBlock的高度自動 – Archana

回答

1

的這裏的問題是,在默認情況下,PivotHeaderItem的高度被設定爲,當TextBlock的高度大於48時,它會顯示的只是其中的一部分。

要找到它,您可以在Visual Studio中使用Live Visual Tree。當您在Live Visual Tree中選擇PivotHeaderItem並查看Live Properties時,您會發現它具有默認樣式,其中Height設置爲48
enter image description here

而且您可以在PivotHeaderItem styles and templates找到默認樣式。

要解決此問題,您可以在Page.Resources中添加以下代碼,將PivotHeaderItem的高度設置爲自動。並且不需要更改Pivot控件的默認樣式。

<Style TargetType="PivotHeaderItem"> 
    <Setter Property="Height" Value="Auto" /> 
</Style> 
+0

謝謝你的迴應,這個解決方案效果很好。 – SwitchOn

0
Give TextBlock `height=auto`, and you have also mentioned PivotHeaderPanel height also. That also might be causing problem. Give the sufficient height or give `Height=Auto` 


<PivotItem.Header> 
     <TextBlock Height="Auto " FontSize="51">Mouse Support</TextBlock> 
</PivotItem.Header> 
+0

這並沒有解決我的問題 – SwitchOn

+0

您可以發佈包含轉動控制完整的XAML? – Archana

+0

這是Microsoft [示例](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/XamlPivot)中的一個小調整。只需閱讀@ JayZuo-MSFT上面的文章即可找到解釋。感謝您的關注。 – SwitchOn

相關問題