views:

15

answers:

1

Why would that work:

<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
  <Setter Property="Background" Value="LightBlue"/>
</Style>

And not this?

<ListView.View>
     <GridView>
         <GridView.ColumnHeaderContainerStyle>
             <Style>
                <Setter Property="Background" Value="Orange" />
             </Style>
         </GridView.ColumnHeaderContainerStyle>
...

thanks

+1  A: 

You need to set the TargetType property on the Style or the parser won't know how to resolve Background:

<ListView.View>
    <GridView>
        <GridView.ColumnHeaderContainerStyle>
            <Style TargetType="GridViewColumnHeader">
                <Setter Property="Background" Value="Orange" />
            </Style>
        </GridView.ColumnHeaderContainerStyle>

It's also possible to qualify the property name in the Setter:

<Setter Property="GridViewColumnHeader.Background" Value="Orange" />

but that syntax is intended for attached properties.

Quartermeister
Thank you! It's so dumb and I didn't think of that.
keyle