如何延迟 DataGrid 中绑定 SelectedItem 的设置
我在单个 Silverlight 视图中显示了主从详细信息。主数据是部分填充项目的 DataGrid。当我在 DataGrid 中选择一个项目时,我的服务会返回一个完全填充的数据对象,该对象在详细信息视图中呈现。
当用户使用键盘光标键滚动数据网格时,这会导致问题,因为用户滚动过去的每个项目都会调用“loadDetails()”服务方法。
如何将 LoadDetails() 调用延迟几毫秒以确保用户已“确定”他们想要获取详细信息的项目?
谢谢,
标记
I have a master-detail display in a single Silverlight view. The master is a DataGrid of partially populated items. When I select an item in the DataGrid, my service returns a fully populated data object, which is rendered in the Detail view.
This causes a problem when the user scrolls the data grid with the keyboard cursor keys because the "loadDetails()" service method is getting called for every item that the user scrolls past.
How can I delay the LoadDetails() call for a few milliseconds to ensure the user has 'settled' on an item for which they want to get details?
Thanks,
Mark
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在数据网格的 OnItemSelected 事件上实现一个延迟计时器,当计时器到期时,您可以执行 LoadDetails() 函数。
或者将负载详细信息放入另一个线程中,使该线程休眠 x 毫秒,然后启动该线程。当您想从该线程写回到 GUI 时,这会有点复杂。
You should implement a delay timer on the OnItemSelected event of your datagrid, when the timer expires, you can execute your LoadDetails() function.
Or place load details in another thread, put the thread to sleep for x milliseconds and then start the thread. This is a bit more complicated when you then want to write back to your GUI from that thread.