using System.Globalization; using System.Windows.Data; namespace Plugin.BurnIn { public class FontSizeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (parameter == null) return 15; string[] ps = parameter.ToString().Split(','); int size = int.Parse(ps[0]); int baseSize = int.Parse(ps[1]); if (value is double width) { return CountFontSize(size, width, baseSize); } return 15; } public static double CountFontSize(double size, double limit, double baseSize) { return size * limit / baseSize; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }