WPF Binding小数,文本框不能输入小数点的问题

  public class DecimalConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value.ToString().EndsWith(".") ? "." : value;
        }
    }
<TextBox  Text="{Binding Qty,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource decimalConverter}}"  />
原文地址:https://www.cnblogs.com/czly/p/12504728.html