【发布时间】:2017-06-28 12:13:00
【问题描述】:
我正在寻找一种在Style 中设置绑定属性UpdateSourceTrigger 的方法。目前我在每个TextBox 上手动设置它,如下所示:
<TextBox Text="{Binding boundValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
我想做的是这样的(但这显然行不通):
<Window.Resources>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Binding.UpdateSourceTrigger" Value="PropertyChanged" />
</Style>
</Window.Resources>
<Grid>
<TextBox Text="{Binding boundValue, Mode=TwoWay}"/>
</Grid>
【问题讨论】:
标签: c# wpf xaml data-binding wpf-style