具有数据表绑定的 Infragistics ultragrid
我有一个绑定到数据表的ultragrid,我在线程(不是gui线程)中更新数据表。我的问题是,在更新数据表时,我是否需要将其委托给 gui 线程(以便网格上的更新发生在 gui 线程中),或者我可以简单地更新任何线程中的数据表,并且 infragistics 网格负责在正确的线程中更新自身?
我在基础设施在线帮助或文档中找不到简单问题的答案。
谢谢
I have a ultragrid which is bound to a datatable, i update datatable in a thread (not a gui thread). My question is that while updating datatable do I need to delegate it on gui thread (so that update on grid happens in gui thread) or I can simply update datatable in any thread and infragistics grid takes care of updating itself in correct thread?
I couldn't find answer to simple question in infragistics online help or docs.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在 UI 线程上更新数据源。 Infragistics 论坛上也有一些类似的讨论,例如:one, 两个,三个。
You need to update the data source on the UI thread. There are some similar discussions on the Infragistics forums, for example: one, two, three.
我发现执行此操作的最佳方法是使用synchronizationContext 对象将.add 调用发布到GUI 线程。
在我的情况下,我有一些具有synchronizationContext类型属性的类,在类初始化时我将其设置为SynchronizationContext.Current。然后我可以调用类似的方法:
SyncContext.Post(Sub()
_displaySource.Rows.Add(r)
End Sub, Nothing)
当类在不同的线程上运行并且工作正常时。如果没有这个,你偶尔会得到恼人的红色 X
best way i found to do this was to use a synchronizationContext object to post the .add call to the GUI thread.
in my situation i have classes with a property of type synchronizationContext that i set to SynchronizationContext.Current when the class is initialized. then i can call something like:
SyncContext.Post(Sub()
_displaySource.Rows.Add(r)
End Sub, Nothing)
when the class is running on a different thread and it works fine. without this you will get the annoying red X occasionally