本文介绍了数据网格样式表 - 左上角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的造型一个DataTable,但我无法弄清楚如何风格提交的数据表格的左上方。正是在这张照片的灰色区域:
你知道怎么做了。
下面就是我的风格至今:
<风格的TargetType ={X:类型的DataGrid}>
< setter属性=保证金VALUE =5/>
< setter属性=背景>
< Setter.Value>
<一个LinearGradientBrush终点=0.5,1StartPoint可以=0.5,0>
<渐变停止颜色=白/>
<渐变停止颜色=艾莉斯蓝偏移量=1/>
< /一个LinearGradientBrush>
< /Setter.Value>
< /二传手>
< setter属性=RowBackground>
< Setter.Value>
<一个LinearGradientBrush终点=0.5,1StartPoint可以=0.5,0>
<渐变停止颜色=#BAF0FF/>
<渐变停止颜色=灰蓝偏移量=1/>
< /一个LinearGradientBrush>
< /Setter.Value>
< /二传手>
< setter属性=AlternatingRowBackground>
< Setter.Value>
<一个LinearGradientBrush终点=0.5,1StartPoint可以=0.5,0>
<渐变停止颜色=白/>
<渐变停止颜色=艾莉斯蓝偏移量=1/>
< /一个LinearGradientBrush>
< /Setter.Value>
< /二传手>
< setter属性=HorizontalGridLinesBrushVALUE =浅灰色/>
< setter属性=VerticalGridLinesBrushVALUE =浅灰色/>
< /样式和GT;
解决方案
此的我能够创建此代码,正确设置按钮的风格:
<&DataGrid的GT;
< DataGrid.Resources>
<风格的TargetType =按钮X:键={ComponentResourceKey RESOURCEID = DataGridSelectAllButtonStyle,TypeInTargetAssembly = {X:类型的DataGrid}}>
< setter属性=背景VALUE =黑/>
< /样式和GT;
< /DataGrid.Resources>
< / DataGrid的>
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:
Do you know how to do it?
Here is my style so far:
<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>
解决方案
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>
这篇关于数据网格样式表 - 左上角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!