This is a migrated thread and some comments may be shown as answers.

BusyIndicator not visible in some cases

1 Answer 932 Views
BusyIndicator
This is a migrated thread and some comments may be shown as answers.
yigal
Top achievements
Rank 1
yigal asked on 28 Jun 2016, 08:41 AM

I'm using MVVM with property "IsBusy", set the DataContext to this property and change it when needed.

The problem is that in some cases the BusyIndicator (BI) is not visible.

Here is how the BI configured:

<telerik:RadBusyIndicator x:Name="CashierBusyIndicator" IsBusy="{Binding IsBusy}" >                 <Style TargetType="telerik:RadBusyIndicator">

The view model seems like that:

public class CashierStationMainWindowModel : INotifyPropertyChanged
    {
 
        private bool _IsBusy;
 
        public bool IsBusy
        {
            get
            {
                return _IsBusy;
            }
            set
            {
                _IsBusy = value;
                OnPropertyChanged("IsBusy");
            }
        }
 
        #region INotifyPropertyChanged implementation
        public event PropertyChangedEventHandler PropertyChanged;
 
        private void OnPropertyChanged(string propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }

The method that change the BI is:

protected void EnableDisableBusyIndicatorAsync(bool enable)
    {
CashierStationMainWindow.GetInstance().CashierStationWindowModel.IsBusy = enable;    
 }

Simple not working example, this block is a button press implementation:

EnableDisableBusyIndicatorAsync(true);
 
System.Threading.Thread.Sleep(5000);
 
EnableDisableBusyIndicatorAsync(false);

Some more info:

* The BI located at RadWindow object.

* The not working block run from a RadPage located inside the RadWindow

* Other RadPages call the EnableDisableBusyIndicatorAsync method and it works fine.

 

Thanks in advanced,

Eliran

 

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 30 Jun 2016, 08:12 AM
Hi Eliran,

As any UI control RadBusyIndicator is rendered in the UI thread and if that thread is frozen it will not show as expected - as you have already observed when setting Sleep the UI thread gets frozen. You need to make sure that thread is not frozen when setting the IsBusy property of the control. Because of that we suggest you to use a BackgroundWorker in order to visualize the BusyIndicator as expected. We have created a sample project using the provided code-snippets that demonstrates how to show RadBusyIndicator using a BackgroundWorker.

We hope this will help you.

Regards,
Nasko
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
BusyIndicator
Asked by
yigal
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or