行标题列标题的Datagrid样式

编程入门 行业动态 更新时间:2024-10-11 23:16:50
本文介绍了行标题列标题的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样式

本文发布于:2023-11-05 18:11:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1561509.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标题   样式   Datagrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!