如何检测在WPF中完成的数据绑定 [英] How to detect data binding completed in WPF

查看:117
本文介绍了如何检测在WPF中完成的数据绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在树视图中选择一个项目时,我的viewmodel类中有一个显着的时间间隔被实例化到视图刷新,树形节点被点亮。

When I select an item on my treeview, there is a notable time gap from my viewmodel class being instantiated to the view refreshing and the treeview node being hi-lit.

在此期间,我需要显示一个等待光标 - 我已经尝试包装实例化我的viewmodel类的代码,但光标回到了一个箭头在整个数据绑定似乎完成之前几秒钟,并且节点得到高亮度。有没有一些事件告诉我绑定完成后,节点是否亮起?

I need to show a wait cursor during this time - I've tried wrapping the code that instantiates my viewmodel class, but the cursor is back to an arrow a couple of seconds before the whole data binding seems to finish and the node gets hi-lit. Is there some event that tells me when the binding is finished, or when the node is hi-lit ?

这与扩展节点无关,

感谢任何帮助。

推荐答案

所有的TreeView控件上的事件将在所有绑定设置完成之后发生。我认为这是在一切都被绘制之前发生的,所以它可能不是你所需要的。

The Loaded event on the desired TreeView control will happen after all of the bindings have been set up. I think it happens before everything has been drawn though so it might not be exactly what you need.

这篇关于如何检测在WPF中完成的数据绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆