29 lines
779 B
C#
29 lines
779 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media;
|
|
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.Converter
|
|
{
|
|
public class NumberSmaller0ColorConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
decimal d;
|
|
bool b = decimal.TryParse(value.ToStringNullCheck(), out d);
|
|
if (b && d < 0)
|
|
{
|
|
return Brushes.Red;
|
|
}
|
|
|
|
return Brushes.Black;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
} |