行标题列标题的Datagrid样式 [英] Datagrid style for columnheader of rowheader

查看:200
本文介绍了行标题列标题的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样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆