I have got a datagri开发者_StackOverflowd and it has declared
ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}"
and in this style I have
<Setter Property="Padding" Value="4" />
How can I change padding of header at particular column without changing style?
I need to do it, because at start I have cut headertext, and I need decrease padding to 2 at this column to display full text.
Create another Style
using BasedOn
property to re-use the exisitng style:-
<Style x:Key="SpecialDataGridColumnHeaderStyle" BasedOn="{StaticResource DataGridColumnHeaderStyle}" TargetType="DataGridColumnHeader">
<Setter Property="Padding" Value="4" />
</Style>
Now on the specific DataGridColumn
you can assign this special style to the HeaderStyle
<DataGridTextColumn ... HeaderStyle="{StaticResource SpecialDataGridColumnHeaderStyle}" />
精彩评论