IMO the most flexible solution will be to add some kind of ErrorToColor
converter. Then use this XAML:
<Setter Property="Foreground" >
<Setter.Value>
<SolidColorBrush Color="{Binding Error, Converter={StaticResource errorToColorConverter}}" />
</Setter.Value>
</Setter>
Such converter could look like this:
public class IntToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value is int && ((int)value) > 50 ? Colors.Green : Colors.Red;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
This way you can easily manage colors for different error values.