WPF TextBox绑定Int类型的属性

TextBox双向绑定int属性,清空输入框时Setter方法未触发。

我的解决方案:

1、属性置为int?;

2、xmlns:sys="clr-namespace:System;assembly=mscorlib"

3、Text="{Binding Number,Mode=TwoWay,TargetNullValue={x:Static sys:String.Empty},UpdateSourceTrigger=PropertyChanged}"

猜你喜欢

转载自www.cnblogs.com/bobyuanyuan/p/11201156.html