ItemsControl SourceUpdated无法触发 [英] ItemsControl SourceUpdated not firing
本文介绍了ItemsControl SourceUpdated无法触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个ItemsControl绑定到这样的集合:
I have an ItemsControl that is bound to a collection like so:
<ItemsControl ItemsSource="{Binding Path=AllComponents, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}" x:Name="myItemsControl" SourceUpdated="Components_Updated">
事件处理程序:
Event Handler:
private void Components_Updated(object sender, DataTransferEventArgs e)
{
//stuff goes here
}
唯一的问题是,当我向集合中添加内容时,SourceUpdated事件永远不会触发.我的处理程序永远不会被呼叫.
有人知道如何解决此问题吗?
The only problem is that the SourceUpdated event never fires when I add something to the collection. My handler never gets called.
Anyone know how to fix this?
推荐答案
是否有PreviewSourceUpdated?我发现总是调用Preview事件,但不是调用该事件,因为树上的某个东西可以阻止它们.
Is there a PreviewSourceUpdated ? I found that the Preview events are always called, but the events are not, because something higher up the tree can stop them.
这篇关于ItemsControl SourceUpdated无法触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文