更新UIcontrol,调度程序和线程 [英] Update UIcontrol , dispatcher and Threading

查看:81
本文介绍了更新UIcontrol,调度程序和线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我可以在没有调度员调用的情况下强制更新或修改UIElement,

使用另一个线程吗?

谢谢

Hello
Can i force updating or modifying a UIElement without dispatcher invoking,
using another thread ??
Thanks

推荐答案

排序。您可以对某些绑定执行的操作是替换绑定作为源的属性上的值。然后,这将更新绑定的target属性。如果您使用的是WPF 3.5或4.0,则始终必须替换属性中的完整值。因此,如果该属性持有集合,则必须替换集合(而不是集合中的项目)。如果你搞乱了当前的集合,而不是替换它,那么你会得到一个例外。我已经读过WPF的新版本允许你改变来自不同线程的集合,但我在工作时使用WPF 4.0,所以我不想依赖它没有的功能,所以我没有我试过了。
Sort of. What you can do on some bindings is replace the value on the property that the binding is as a source. This will then update the binding''s target property. If you are using WPF 3.5 or 4.0, you will always have to replace the complete value in the property. So, if that property is holding a collection, you have to replace the collection (not the items in the collect). If you mess around with the current collection, instead of replacing it, then you will get an exception. I''ve read that the new version of WPF lets you alter collections from a different thread, but I was using WPF 4.0 at work so I didn''t want to get dependent on features it doesn''t have, so I haven''t tried that out.


这篇关于更新UIcontrol,调度程序和线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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