xaml – 如何更改模板中数据透视表项目标题的大小
发布时间:2020-12-14 01:48:38 所属栏目:Windows 来源:网络整理
导读:我希望能够修改默认的数据透视表模板来更改数据透视表项标题的大小.我如何使用以下样式执行此操作 Style x:Key="PivotStyle" TargetType="phone:Pivot" Setter Property="Margin" Value="0"/ Setter Property="Padding" Value="0"/ Setter Property="Foregro
我希望能够修改默认的数据透视表模板来更改数据透视表项标题的大小.我如何使用以下样式执行此操作
<Style x:Key="PivotStyle" TargetType="phone: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="phone:Pivot"> <Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid CacheMode="BitmapCache" Grid.RowSpan="2" > <Grid.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Color="Transparent" Offset="0.0" /> <GradientStop Color="Transparent" Offset="1.0" /> </LinearGradientBrush> </Grid.Background> </Grid> <Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache" Grid.Row="2" /> <ContentPresenter ContentTemplate="{TemplateBinding TitleTemplate}" Content="{TemplateBinding Title}" Margin="24,17,-7" /> <Primitives:PivotHeadersControl x:Name="HeadersListElement" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="28" Grid.Row="1"/> <ItemsPresenter x:Name="PivotItemPresenter" Margin="{TemplateBinding Padding}" Grid.Row="2"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> 我试图让这个模仿以下
您可以通过更改HeaderTemplate来更改您的Pivot Header的字体大小,族等等:
<phone:Pivot Title="PivotTest" Style="{StaticResource PivotStyle}"> <phone:Pivot.HeaderTemplate> <DataTemplate> <TextBlock Text="{Binding}" FontSize="10"/> </DataTemplate> </phone:Pivot.HeaderTemplate> <phone:PivotItem Header="One"> // item 1 </phone:PivotItem> <phone:PivotItem Header="Two"> // item 2 </phone:PivotItem> </phone:Pivot> 编辑 – 在一种风格: <phone:PhoneApplicationPage.Resources> <DataTemplate x:Key="myHeader"> <TextBlock Text="{Binding}" FontSize="10"/> </DataTemplate> <Style x:Key="PivotStyle" TargetType="phone:Pivot"> <Setter Property="HeaderTemplate" Value="{StaticResource myHeader}"/> <Setter Property="Margin" Value="0"/> .... (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- 订购执行WiX SetProperty操作
- windows-xp – 在Windows XP上安装Windows 7启动
- windows-phone-7 – 防止Windows Phone中的Pivot
- 如何在Microsoft Edge Web浏览器中启用Java?
- winapi – Win32.如何将POINT转换为LPARAM
- windows – 使用.bat文件配置WinRM,不带/是提示
- windows-server-2008 – Windows Server重启/关闭
- Windows C对话框缩放器类
- windows-server-2008 – 组策略设计
- windows-server-2008 – RDP到Windows Server 20
热点阅读