WPF Binding小数,文本框不能输入小数点的问题
时间:2020-03-16 18:12:57
收藏:0
阅读:616
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
评论(0)