using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace AIK.Views.Converters { public class DoubleToDiameterConverter : IValueConverter { public static DoubleToDiameterConverter Instance { get; } = new DoubleToDiameterConverter(); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is double radius) { return radius * 2; // 半径转直径 } return 0; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }