I would like to create a style that makes my cell's content green if positive, red if negative or black if 0.
I know about converters and bindings, but is it possible to do this without naming the field the specific column is bound to (eg. I was to base on whatever is the cell's value)?
<Style x:Key="GreenIfPositive" TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Style.Triggers>
<DataTrigger Binding="{Binding, Converter={StaticResource greaterThanZeroDecimalConverter}}" Value="True">
<Setter Property="Foreground" Value="Green"/>
</DataTrigger>
<DataTrigger BBinding="{Binding, Converter={StaticResource greaterThanZeroDecimalConverter}}" Value="False">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding}" Value="0">
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
</Style.Triggers>
</Style>
So that I could use it on columns without re-iterating that style just so I can select the property I'm basing this on.