在我的 Phone 7 应用程序中,我使用了枢轴控件。现在我想更改其标题和标题区域的背景。我怎样才能实现这个目标?
是否有可定制的枢轴控件的整体模板?
我已经尝试将包含枢轴控件的网格的背景设置为标题颜色,然后将每个枢轴项的背景设置为原始背景颜色。第一眼看起来不错。但是,当您将枢轴项目向左擦除以显示第二个项目时,两个枢轴项目之间会出现一个以标题颜色着色的区域。所以这种方法是行不通的。
此外,我尝试自定义标题和标题项的模板。但这些模板仅覆盖文本本身的区域,而不是整个标题和模板区域。
这是更改控件模板的变体。将背景=“红色”更改为您想要的任何画笔。
<Style x:Key="PivotStyle1" TargetType="controls:Pivot">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<Grid/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Pivot">
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="Red" CacheMode="BitmapCache" Grid.RowSpan="2" />
<Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache"
Grid.Row="2" />
<ContentPresenter ContentTemplate="{TemplateBinding TitleTemplate}"
Content="{TemplateBinding Title}" Margin="24,17,0,-7"/>
<controlsPrimitives:PivotHeadersControl x:Name="HeadersListElement"
Grid.Row="1"/>
<ItemsPresenter x:Name="PivotItemPresenter"
Margin="{TemplateBinding Padding}" Grid.Row="2"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
....
<controls:Pivot Title="MY APPLICATION" Style="{StaticResource PivotStyle1}">
....
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)