如何暂停 DataTable 通知或数据绑定以防止 UI 更新
我有一个数据网格(Infragistic UltraGrid),它的数据绑定到数据表。
我想更新数据表而不在数据网格上显示任何更改,直到用户单击按钮。
我尝试了以下方法来暂停网格更新,但都不起作用。可能我不太明白数据绑定是如何工作的。
ultraGrid.BeginUpdate()
- 这是阻止网格绘制的 ultraGrid 特定方法。与 Aero 主题配合良好,但如果您在窗口上使用“经典”主题,网格不会自行绘制,因为绘制已暂停。BindingSource.SuspendBinding()
- 这只暂停对底层源的 UI 更改,而不是相反BindingSource.RaiseListChangedEvent = false
- 尝试将其设置为 false,但网格仍然更新Grid.BindingContext = new BindingContext()
- 尝试查看是否可以删除任何底层绑定以防止网格更新。这根本不起作用,也不知道如何使用它
其他想法:
ultraGrid.SetDataBinding(null, null)
- 它基本上删除了网格上不存在的所有信息我想要什么。创建快照并覆盖网格 - 这确实是一个 hack,这是其他人建议的。我试图避免这样做。
请注意,在网格更新期间,用户无法访问网格,因为有一个模式窗口打开。用户通过该模式窗口更新数据表。这个想法是,当用户单击“确定”按钮时,他们将看到网格中的更改。
谢谢
I got a DataGrid (Infragistic UltraGrid) that is databinded to a DataTable.
I would like to update the DataTable without showing any changes on the data grid until user click a button.
I have tried the following methods to suspend the grid udpate, and none of them works. Probably I don't really understand how data binding works.
ultraGrid.BeginUpdate()
- this is ultraGrid specific method that stop grid from painting. Works well with Aero theme, but if you use "classic" theme on window, the grid doesn't draw itself since painting is suspended.BindingSource.SuspendBinding()
- This only suspend UI change to the underlying source, not the otherway aroundBindingSource.RaiseListChangedEvent = false
- Tried to set it to false, but the grid still update itself.Grid.BindingContext = new BindingContext()
- trying to see if I can remove any underlying binding to prevent update on the grid. This doesn't work at all and don't know how to use it
Other ideas:
ultraGrid.SetDataBinding(null, null)
- It basically remove all the information on the grid which is not what I want.Create snapshot and cover the grid - This is really a hack, which was suggested by other. I am trying to avoid doing such hack.
Please note that during the grid update, user can't access the grid because there is a modal window open. The user update the data table though this modal window. The idea is that when user click the OK button, they will see the changes in the grid.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道完全抑制数据源更改上的任何活动的唯一方法是使用 UltraGrid 的 ISupportInitialize 接口实现:
The only way I know to totally suppress any activity on DataSource change is to use UltraGrid's implemenation of ISupportInitialize interface: