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

posted @ 2019-07-17 15:09  bobyuanyuan  阅读(1926)  评论(0)    收藏  举报