RadGridView IsBusy indicator not displaying until data is loaded

1 Answer 83 Views
BusyIndicator GridView
Toby
Top achievements
Rank 1
Toby asked on 01 Nov 2022, 04:34 PM

Hello,

I've got a RadGridView populated with an ObservableCollection of data that is loaded externally. The process of loading the data and displaying it takes some time and I would like to show something to the user to indicate busyness. 

I know RadGridView has a built in IsBusy property, Unfortunately, the indicator doesn't appear until the data has already loaded - I've tested this by setting IsBusy to true when I define it - it only appears once the grid is loaded and the data is displayed. I've also tried using the BusyIndicator and wrapping the grid with this but encountered the same problem in that it would only display once the rest of the grid was displayed.

I wonder if I'm missing something and there is still a way of using the in-built feature for my needs?

Cheers,

Toby

 

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 03 Nov 2022, 11:18 AM

Hello Toby,

The busy indicator is meaningful only for actions that happen on a background thread. This is because the busy indicator is a WPF control, therefore it is rendered on the UI thread. If the UI thread is blocked, the busy indicator will also freeze. This said, you can show the indicator while loading the data by moving the loading action on another thread. However, the assigning of the data to the RadGridView control happens on the UI thread, which means that you cannot use the busy indicator for this scenario. What I can suggest you for improving the user experience here is to check the Performance Tips and Tricks article.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Toby
Top achievements
Rank 1
commented on 22 Nov 2022, 11:51 AM

Hello Martin,

Thank you for your quick response.

Just a quick question as the article you link suggests using a BusyIndicator when binding large datasets to the control. On startup we load the data into the collection and that is used for binding to the grid. The loading of external data and population of the dataset doesn't happen on the UI thread, just the binding. As the article says this would be a potential use of the busy indicator I wonder if this would be possible? 

"Binding large datasets to the control is a time consuming task that can at times test the users' patience. To provide better user experience RadGridView exposes an IsBusy property through which you can display a busy indicator while the data is loading."

Cheers,

Toby

Martin Ivanov
Telerik team
commented on 23 Nov 2022, 08:13 AM

Hey Toby, yes, you can use the busy indicator during your data loading process that happens on another thread. Before starting the thread that loads the data, you can show the busy indicator and then hide it when the loading is done. Note that if you need to hide the busy indicator on the other thread, you will need to dispatch this setting to the main UI thread. This is done using a dispatcher.
Toby
Top achievements
Rank 1
commented on 28 Nov 2022, 02:25 PM | edited

Hi Martin,

Great thanks. I have something that works now - needed to add DisplayAfter=0 for it to display before it started loading in the data from collection. 

Next question: I've made some styling changes including setting OverlayStyle to be transparent to just display grid behind. Now an issue I have is that the rows in the grid are assigned a white colour. I can't see which property would be driving this, could you help please? Would just like the indicator to hide once IsBusy=false and the grid to be displayed behind the indicator

Cheers,

Toby

Martin Ivanov
Telerik team
commented on 29 Nov 2022, 10:27 AM

I am not sure that I understand the exact issue. Can you send over some screenshots showing the white colored cells you mentioned? Also, can you check if the following article answers your question? https://docs.telerik.com/devtools/wpf/controls/radgridview/selection/how-to/unfocused-state

 

Toby
Top achievements
Rank 1
commented on 29 Nov 2022, 11:09 AM

 

So, without the busy indicator the data just loads normally and white doesn't appear. However once the data is loaded and just before the indicator hides the grid turns white. Before the data loads the overlay is transparent and this is what I have for this:

 

        <telerik:RadBusyIndicator.OverlayStyle>

            <Style TargetType="Rectangle">

                <Setter Property="Stroke" Value="Transparent" />

            </Style>

        </telerik:RadBusyIndicator.OverlayStyle>

 

Thanks, but EnableLostFocusSelectedState is already set to false for the grid

 

Cheers,

Toby

Martin Ivanov
Telerik team
commented on 30 Nov 2022, 11:21 AM

Thank you for the picture. I've tried to recreate this effect, but to no avail. Can you check the attached project and tell me if I am missing anything?
Toby
Top achievements
Rank 1
commented on 30 Nov 2022, 11:57 AM

Hello Martin,

Thank you. Doesn't look like you're missing anything - but when I run the code I notice the rows turn grey when the busy indicator is working: 

 

 

 

This is despite the layover style being transparent. What causes this behaviour? That might be the cause of the problem I'm having?

Martin Ivanov
Telerik team
commented on 30 Nov 2022, 02:03 PM

You may be right. When you place a control in the Content of RadBusyIndicator, the busy indicator will set its IsEnabled property to False, while IsBusy is  True. This setting will be inherited by all elements in the visual tree of the associated parent. The rows become gray because their IsEnabled is False. If the Telerik theme you are applying uses white color as the background for disabled elements or if there is custom style for this, you can observe the reported behavior.

To avoid this, you can move RadGridView outside of RadBusyIndicator. For example, you can place it under it. You can see this shown in the attached project.

Toby
Top achievements
Rank 1
commented on 30 Nov 2022, 02:36 PM

Thanks very much Martin, that's done the trick! :) 
Tags
BusyIndicator GridView
Asked by
Toby
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or