using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; namespace FWindSoft.Wpf.Converter { public class DoubleGridLengthConverter : IValueConverter { public static DoubleGridLengthConverter Instance = new DoubleGridLengthConverter(); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return GridLength.Auto; double length = 0; if (value is double) { length = System.Convert.ToDouble(value); } if (length < 10) return GridLength.Auto; return new GridLength(length); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }