是否有 DataGrid“渲染完成"?事件? [英] Is there a DataGrid "rendering complete" event?
问题描述
当我加载 DataGrid 时,我将光标更改为等待图标,将数据从数据库加载到我的 ItemsSource,然后将光标设置回默认值.这很有效,除了在填充 ItemsSource 和 DataGrid 实际呈现数据之间存在延迟之外,因此光标过早地变回默认值.
When I load my DataGrid, I change the cursor to the wait-icon, load data into my ItemsSource from a database, and then set the cursor back to default. This works great, except for the fact that there is a delay in between when the ItemsSource is populated and when the DataGrid actually renders the data, so the cursor changes back to default too early.
是否有在 DataGrid 完全渲染完成时触发的事件,以便我的光标可以在正确的时间返回默认值?
Is there an event that is fired when a DataGrid is completely done rendering so that my cursor can return to default at the correct time?
推荐答案
在元素布局、呈现并准备好交互时发生.
Occurs when the element is laid out, rendered, and ready for interaction.
编辑
或者,在您更改数据源之后执行以下操作.因此,它会在应用程序空闲时重置 Cursor.
Or, just after you change the DataSource execute the following. So, it will reset the Cursor when application is idle.
Dispatcher.InvokeAsync(() => { System.Windows.Input.Mouse.OverrideCursor = null; },
DispatcherPriority.ApplicationIdle);
这篇关于是否有 DataGrid“渲染完成"?事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!