本文介绍了行标题列标题的Datagrid样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI 我想将样式应用于行标题的columnheader ...但其nt有效. 只是处理行标题的样式..但是nt适用于行标题的columnheader. < Style x:Key ="DataGridStyle" TargetType ="local:DataGridRowGroupHeader"> < setter property ="Background" value ="black"> </Style>
HI I want to apply style for columnheader of row header ... but its nt working . just working on the styles of row header .. but nt work for columnheader of row header. <Style x:Key="DataGridStyle" TargetType="local:DataGridRowGroupHeader"> <setter property="Background" value="black"> </Style>
推荐答案您是否要设置DataGridRowGroupHeaders的样式? 如果是这样,则类似这样(摘自DataGrid.RowGroupHeaderStyles文档)... Are you trying to style the DataGridRowGroupHeaders? If so, something like this (taken from the DataGrid.RowGroupHeaderStyles documentation)... <sdk:DataGrid.RowGroupHeaderStyles> <!-- Style for groups at top level --> <Style TargetType="sdk:DataGridRowGroupHeader"> </Style> <!-- Style for groups under the top level --> <!-- <Style TargetType="sdk:DataGridRowGroupHeader"> <Setter Property="Background" Value="#44225566" /> </Style> --> </sdk:DataGrid.RowGroupHeaderStyles>
修改TopLeftHeaderTemplate进行更改. Modify TopLeftHeaderTemplate to change that. <!--Start: TopLeftHeaderTemplate--> <ControlTemplate x:Key="TopLeftHeaderTemplate" TargetType="localprimitives:DataGridColumnHeader"> <Grid Name="Root"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Border BorderThickness="0,0,1,0" BorderBrush="#FFC9CACA" Background="#FF1F3B53" Grid.RowSpan="2"> <Rectangle Stretch="Fill" StrokeThickness="1"> <Rectangle.Fill> <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1"> <GradientStop Color="Yellow" Offset="0.015" /> <GradientStop Color="Yellow" Offset="0.375" /> <GradientStop Color="Yellow" Offset="0.6" /> <GradientStop Color="Yellow" Offset="1" /> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> </Border> <Rectangle VerticalAlignment="Bottom" Width="Auto" StrokeThickness="1" Height="1" Fill="#FFDBDCDC" Grid.RowSpan="2"/> </Grid> </ControlTemplate>
更多推荐
行标题列标题的Datagrid样式
发布评论