How does IsBusyIndicationVisible work ?

2 posts, 0 answers
  1. Chaitanya
    Chaitanya avatar
    3 posts
    Member since:
    Aug 2012

    Posted 09 Aug 2012 Link to this post

    I have a situation where I need to know when the RADBusyIndicator is unloaded. The IsBusy is binded to a property 'ShowMessage' and when I do in the code behind:

    public void foo()
            obj.ShowMessage = false; //Set IsBusy binded property in View Model names 'obj' to false
            while (busyIndicator.IsBusyIndicationVisible)
                    { System.Threading.Thread.Sleep(100);}

            //--------- Code to execute after BusyIndicator unloaded

    However this does not work and code goes into an infinite loop at the while.

    Next I executed:

    while (busyIndicator.IsBusyIndicationVisible)
                    { System.Threading.Thread.Sleep(100);}

            //--------- Code to execute after BusyIndicator unloaded

    In a separate thread, but that also does not work which is very strange. I seems BusyIndicator blocks on every access to busyIndicator.IsBusyIndicationVisible property.

    Any workaround will be very helpful.

  2. Ivo
    Ivo avatar
    390 posts

    Posted 14 Aug 2012 Link to this post

    Hi Chait,

    The IsBusyIndicatorVisible property is set to false when the RadBusyIndicator's fade out animation finishes. By sleeping the thread you block the UI thread and the fade out animation never gets the chance to be played so it never finishes. However I tested this using another thread and it worked as expected. Here is the sample code I used:
            private void Button_Click(object sender, RoutedEventArgs e)
                var viewModel = (ViewModel)this.DataContext;
                viewModel.IsBusy = false;
                Thread backgroundThread = new Thread(new ThreadStart( () =>
                    while (this.IsBusyIndicatorVisible())
            private bool IsBusyIndicatorVisible()
                bool isBusy = true;
                this.Dispatcher.Invoke(new Action(() =>
                    isBusy = BusyIndicator.IsBusyIndicationVisible;
                return isBusy;

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top