Problem with Datagrid Header Background

Asked

Viewed 16 times

2

I have the following block of code setting the style of Header in my shampoo:

<Style TargetType="{x:Type DataGridColumnHeader}">
                    <Setter Property="Background" Value="DimGray"/>
                    <Setter Property="Height" Value="45"/>
                    <Setter Property="Foreground" Value="White"/>
                    <Setter Property="FontFamily" Value="Calibri"/>
                    <Setter Property="FontSize" Value="20"/>
                    <Setter Property="Padding" Value="15 0 0 0"/>
                    <Setter Property="HorizontalAlignment" Value="Stretch"/>
                </Style>

When the value of the property HorizontalAlignment="Stretch" the result is this: Data Grid

But when I change the value to HorizontalAlignment="Center" happens this: Data Grid2

I want it to be centered but with the whole background filled.

  • Let the Property="HorizontalAlignment" Value="Stretch" and include one more tag HorizontalContentAlignment="Center".

  • Didn’t work out :(

  • One property overwritten the other

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.