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}}" />

浙公网安备 33010602011771号