是否有DataGrid“渲染完成”事件? [英] Is there a DataGrid "rendering complete" event?

查看:224
本文介绍了是否有DataGrid“渲染完成”事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我加载DataGrid时,我将光标更改为等待图标,从数据库将数据加载到我的ItemsSource中,然后将光标设置为默认值。这是非常好的,除了事实之间,当ItemsSource被填充和DataGrid实际呈现数据之间的延迟,所以光标更改回到默认太早。



/ p> $ p

解决方案

/ div>

FrameworkElement.Loaded事件



元素布局,渲染并准备进行交互时发生。



编辑



或者,更改DataSource之后,执行以下操作。因此,当应用程序空闲时,它将重置光标。

  Dispatcher.InvokeAsync(()=> {System.Windows。 Input.Mouse.OverrideCursor = null;},
DispatcherPriority.ApplicationIdle);


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.

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?

解决方案

FrameworkElement.Loaded event

Occurs when the element is laid out, rendered, and ready for interaction.

Edit

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆