应用UpdateSourceTrigger = PropertyChanged的所有文本框的WPF [英] Apply UpdateSourceTrigger=PropertyChanged to all textboxes wpf
问题描述
我怎么能写模板这个样子的。
< DataTemplate中...... TextBlock的>
UpdateSourceTrigger = PropertyChanged的
< / DataTemplate中>
您不能改变的默认模式为 UpdateSourceTrigger
在样式。这被配置为 DefaultUpdateSourceTrigger
的 FrameworkPropertyMetadata code>类的当
的DependencyProperty
(在这种情况下,文本
属性)注册。
您既可以创建自定义的文本框中键入从框派生
和变更注册依赖属性时,该值。或者,你可能想看看进入 Caliburn.Micro MVVM框架,它会自动将该对于一个应用程序的所有文本框(通过代码作为基结合其约定)的一部分。
How can I write template look like this?
<DataTemplate ... TextBlock>
UpdateSourceTrigger=PropertyChanged
</DataTemplate>
You cannot change the default mode for the UpdateSourceTrigger
in a style. This is configured as the DefaultUpdateSourceTrigger
of the FrameworkPropertyMetadata
class when the DependencyProperty
(in this case the Text
property) is registered.
You could either create a custom text box type which derives from TextBox
and changes this value when registering the dependency property. Alternatively, you might want to look into the Caliburn.Micro MVVM framework, which automatically sets this for all text boxes in an app (via code, as part of its convention based binding).
这篇关于应用UpdateSourceTrigger = PropertyChanged的所有文本框的WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!