using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace BeDesignerSCADA.Converters { [ValueConversion(typeof(float), typeof(float))] public class MathAbsConverter : IValueConverter { static MathAbsConverter() { Instance = new MathAbsConverter(); } public static MathAbsConverter Instance { get; private set; } public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return Math.Abs((float)value); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }