样式数据网格表 - 左上角 [英] Style datagrid table - Top left corner

查看:30
本文介绍了样式数据网格表 - 左上角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为数据表设置样式,但我不知道如何设置数据网格左上角的样式.就是这张图中的灰色区域:

I am styling a datatable but I can't figure out how to style the top left filed of the datagrid. It is the gray field in this picture:

你知道怎么做吗?

这是我目前的风格:

<Style TargetType="{x:Type DataGrid}">
    <Setter Property="Margin" Value="5" />
    <Setter Property="Background">
        <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="White"/>
                <GradientStop Color="AliceBlue" Offset="1"/>
            </LinearGradientBrush>
        </Setter.Value>
    </Setter>
    <Setter Property="RowBackground">
        <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#BAF0FF"/>
                <GradientStop Color="PowderBlue" Offset="1"/>
            </LinearGradientBrush>
        </Setter.Value>
    </Setter>
    <Setter Property="AlternatingRowBackground">
        <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="White"/>
                <GradientStop Color="AliceBlue" Offset="1"/>
            </LinearGradientBrush>
        </Setter.Value>
    </Setter>
    <Setter Property="HorizontalGridLinesBrush" Value="LightGray" />
    <Setter Property="VerticalGridLinesBrush" Value="LightGray" />
</Style>

推荐答案

从这个 answer 我能够创建这个正确设置按钮样式的代码:

From this answer I was able to create this code which correctly sets the style of the button:

<DataGrid>    
    <DataGrid.Resources>
        <Style TargetType="Button" x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}">
            <Setter Property="Background" Value="Black" />
        </Style>
    </DataGrid.Resources>
</DataGrid>

这篇关于样式数据网格表 - 左上角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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