using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; namespace ivf_tl_Manage.Converts { public class ScrOffectToOpacityConvert : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return 0; if (double.TryParse(value.ToString(), out double ScrOffect) && double.TryParse(parameter.ToString(), out double tarOffset)) if (ScrOffect == tarOffset) return 0; else return 0.05; return 0; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class LeftConvert : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Debug.WriteLine(value); if (value == null) return 0d; if (double.TryParse(value.ToString(), out double width) && double.TryParse(parameter.ToString(), out double oldValue)) { return oldValue - width / 2.0; } return 0d; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }