本文介绍了在XAML中有一种默认UpdateSourceTrigger到PropertyChanged的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





解决方案

在WPF中,UpdateSourceTrigger对每个控件都有不同的默认值,它们无法设置一些可以控制所有元素如何设置UpdateSourceTrigger的内容!您可以定义创建一个可以通过页面并更改所有值的附加行为。

 < Window 
local:DefaultUpdateSourceTrigger =PropertyChanged>

< / Window>

然后可以走视觉树并更改UpdateSourceTriggers!


In XAML (or code) is there a way to default the UpdateSourceTrigger to PropertyChanged for all bindings?

http://msdn.microsoft.com/en-us/library/system.windows.data.binding.updatesourcetrigger.aspx

http://msdn.microsoft.com/en-us/library/system.windows.data.updatesourcetrigger.aspx

解决方案

In WPF, the UpdateSourceTrigger has diffeent default values for each control and their is no way of setting something that will control how all the elements set their UpdateSourceTrigger! You can definetely create a attached behavior that can go thru a page and change all the values?

<Window
     local:DefaultUpdateSourceTrigger="PropertyChanged">

</Window>

This can then walk the visual tree and change the UpdateSourceTriggers!

这篇关于在XAML中有一种默认UpdateSourceTrigger到PropertyChanged的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 02:39