.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson

Home >> Articles >> Silverlight >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Busy Indicator Control In Silverlight to show Wait Message

Posted By:Diptimaya Patra       Posted Date: March 21, 2010    Points: 25    Category: Silverlight    URL: http://www.dotnetspark.com  

Busy Indicator is a control that is added in Silverlight 3 Toolkit November 2009 Release. In this article we will see how to use it while loading a page or doing time consuming operation to show user wait message.


Busy Indicator is a control that is added in Silverlight 3 Toolkit November 2009 Release. In this article we will see how to use it.

Creating the Silverlight Application

Fire up Visual Studio 2008 and create a Silverlight Application, name it as BusyIndicatorSample.


Open your application in Blend 3.

Add some controls to your application. I have added one Button and a TextBox control.


Now add a Busy Indicator Control to your application. Before adding it your application you need to take care of something:
  • Always add the Busy Indicator as your last control in the order. In our case it's in the order
    • TextBox
    • Button
    • BusyIndicator
  • Always make the Busy Indicator's Horizontal and Vertical Alignment to Stretch so that it covers the whole Parent Panel. In our case it's Grid[LayoutRoot]
Now you are ready to add the Busy Indicator.


After adding it you can see several properties associated to it.


You can remove the Content and add your own message in BusyContent.

Now we will add some code in the Button Click event and we will see how it is effective to use BusyIndicator Control.

Name the BusyIndicator as BusyWindow.

private void btnLoad_Click(object sender, RoutedEventArgs e)
  int busyDisplay = 3;
  int delayDisplay = 500;
  BusyWindow.DisplayAfter = TimeSpan.FromMilliseconds(delayDisplay);
  BusyWindow.IsBusy = true;
  ThreadPool.QueueUserWorkItem((state) =>
 Thread.Sleep(busyDisplay * 1000);
  Dispatcher.BeginInvoke(() => BusyWindow.IsBusy = false);
  txtStatus.Text = "Data Saved";

Now run your application and type some text in the TextBox and then click on the Save Data Button.

Now you would understand why we made the Alignment of BusyIndicator as Stretch. If you don't make it, the controls would be available for user to operate on.

Hope you like this article.
 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend