更新UIcontrol,调度程序和线程

编程入门 行业动态 更新时间:2024-10-27 00:33:54
本文介绍了更新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,调度程序和线程

本文发布于:2023-11-25 22:24:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1631595.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:线程   程序   UIcontrol

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!