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?
A Grid is a control for laying out other controls on the form (or page). A DataGrid is a control for displaying tabular data as read from a database for example.
The WPF Data Grid (GridControl) is a data-aware control designed to display and edit data in different layouts: tabular, treelike, and card. The GridControl allows users to manage large amounts of data (sort, group, filter, and so on).
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With