Hi all,
I am really getting mad since several hours... I am trying to do a custom ListView control, almost everything is fine except for the GridViewColumnHeader bar color.
I have an ExListView control overriding ListView and a ExGridViewColumnHeader overriding GridViewColumnHeader. My problem is that only the column header are styled, not the rest of my column header bar. I have seen that to style this one I have to when the Role property is "Padding" but it doesn't do anything. Are style triggers not working when we do a custom control ?
Here is my ExGridViewColumnHeader XAML :
<Style TargetType="{x:Type local:ExGridViewColumnHeader}">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:ExGridViewColumnHeader}">
<Grid>
<Border x:Name="HeaderBorder" Style="{DynamicResource SLV_HeaderBorderStyle}">
<ContentPresenter Name="HeaderContent"
Margin="0,0,0,1"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="True"
Opacity="0.9"/>
</Border>
<Thumb x:Name="PART_HeaderGripper" HorizontalAlignment="Right" Margin="0,0,-9,0" Style="{StaticResource GridViewColumnHeaderGripper}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="HeaderBorder" Property="Style" Value="{DynamicResource SLV_HeaderBorderHoverStyle}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="HeaderBorder" Property="Style" Value="{DynamicResource SLV_HeaderBorderPressedStyle}"/>
<Setter TargetName="HeaderContent" Property="Margin" Value="1,1,0,0"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Role" Value="Padding">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:ExGridViewColumnHeader}">
<Border Name="HeaderBorder" Background="Red" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>