I've have style defined as a resource to format a particular row. All the properties work fine but the background is being ignored. If i comment out the <Setter Property="template"... then the background setter is applied. Any ideas why there is this conflict?
<Style x:Key="cvpDirectionStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource Self}, Path=Value, Converter={StaticResource cvpForegroundBrushConverter}}"/>
<Setter Property="Background" Value="#D6CE78"/>
<Setter Property="FontFamily" Value="Wingdings 3"/>
<Setter Property="FontSize" Value="22"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
Path=Value,
Converter={StaticResource cvpDirectionChangeConverter}}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Hello martinfenech,
I reviewed your issue and what seems to cause this behavior in your snippet, is that when you set the template property, you lose the original template which uses the background property of the CellValuePresenter Class. If you want to use the background setter you can change your template to:
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSourceSelf}, Path=Value, Converter={StaticResource cvpForegroundBrushConverter}}"/>
<Grid Background="{TemplateBinding Background}" >
<ContentControl Content="{Binding RelativeSource={RelativeSource TemplatedParent},
Path=Value}"/>
</Grid>
Please let me know if you need further assistance.