我在标题上有一个带有彩色背景的轴项目
<Grid x:Name="LayoutRoot" Background="Transparent">
<Rectangle
VerticalAlignment="Top" HorizontalAlignment="Stretch"
Height="150" Fill="Red" />
<phone:Pivot >
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize=" 25" />
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:PivotItem Header="item1">
<TextBlock Text="Test" />
</phone:PivotItem>
<phone:PivotItem Header="item2">
<Grid/>
</phone:PivotItem>
</phone:Pivot>
</Grid>
问题是TextBlock只出现在红色背景上,但我希望红色背景只包含标题标题。
如何让Textblock显示在红色背景下?
编辑:
这是一张显示我问题的图片:
我希望这个“测试”文本低于红色背景,我希望那个背景只覆盖我的标题“element1”和“element2”
答案 0 :(得分:0)
使用它可行的
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<controls:Pivot Title="MY APPLICATION">
<!--Pivot item one-->
<controls:PivotItem VerticalAlignment="Top" Height="485" Padding="0" Name="pivotitemRecorder">
<controls:PivotItem.Header >
<Border Margin="-10,20,0,0" Height="70" Width="160" BorderThickness="0" BorderBrush="#FF9666D1" CornerRadius="10" Background="Green">
<Border Width="150" Height="50" Backgroung="Red">
<TextBlock Margin="0,10,0,0" HorizontalAlignment="Center" Text="First" Foreground="White" FontSize="36" FontWeight="Bold" />
</Border>
</Border>
</controls:PivotItem.Header>
</controls:PivotItem>
</controls:Pivot>
</Grid>
答案 1 :(得分:0)
试试这个。
<Grid x:Name="LayoutRoot" Background="Transparent">
<Rectangle VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="89" Fill="Red" />
<phone:Pivot >
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize=" 25" />
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:PivotItem Header="item1" Margin="10,51,14,32">
<TextBlock Text="Hello World! This is a test for item1" Height="640" VerticalAlignment="Bottom" />
</phone:PivotItem>
<phone:PivotItem Header="item2" Margin="10,51,14,32">
<TextBlock Text="Hello World! This is another test for item2" Height="640" VerticalAlignment="Bottom" />
</phone:PivotItem>
</phone:Pivot>
</Grid>
我测试了这个。