Working with BusyIndicator of Telerik Silverlight RadControls
IntroductionLast week I started exploring Telerik RadControls for Silverlight. On Day 1 of exploration, I just gone thru the basic overview of Telerik RadControls and installation steps.
In this post, we will explore the BusyIndicator that comes with RadControls. The basic code is similar to what comes with Silverlight by default. The difference which catches the eye is the circular progress bar.
Let's start exploring it and see what are the properties available there and how to start working with this control.
Setting up the ProjectIf you don't have RadControls library installed in your PC, download the free trial version from Telerik site. The installation steps are mentioned in this post: Day 1: Working with Telerik Silverlight RadControls.
Once your development environment is setup, open your Visual Studio 2010 IDE and click on Create New Project. In the "New Project" dialog Window, select Silverlight from the left panel. This will filter out the Silverlight templates for you.
In the main panel you will see a template called "RadControls Silverlight Application". Select this as the default template for your project, if you want to create a sample project.
In the next step click "Ok". This will ensure that you are creating a web project for hosting your Silverlight application.
In the third screen (as shown below) will give you option to include various libraries required for your application. Chose the appropriate library assembly that you want to use. Cool thing is that, the dependency libraries will also get selected when you select any assembly from that.
This will create the sample project for you. Build and run the application to check for any error.
What's there in RadBusyIndicatorBefore starting with the next part, you might want to know about the RadBusyIndicator control. Well, Busy indicator is a Silverlight control which you can add in your Silverlight application to show a loading indication to your user while saving some sort of operation in database. Generally it is useful when you calling your WCF Service to store something in server or retrieving some data from server.
The Rad BusyIndicator has four visual states named as Hidden, Visible, Busy and Idle. It has some dependency properties called:
- IsBusyIndicatorVisible - You can set whether the busy indicator will be visible or not
- BusyContent - Gets or Sets the content of the Busy Indicator. This will generally come in the UI when busy loads
- BusyContentTemplate - You can change the content template of the Busy indicator
- DisplayAfter - Sets the time duration, after which the busy indicator will show in screen
- IsBusy - Gets or Sets whether the control will go to busy mode
- IsIndeterminate - Sets the indeterminate state of the busy indicator
- OverlayStyle - Changes the style of the overlay element
- ProgressBarStyle - Set this if you want to change the style of the Progress bar
- ProgressBarValue - Gets or Sets the value of the Progress bar that starts while in busy mode
Have a look into the complete list of the members in RadBusyIndicator here:
Playing with the XAMLOnce your project has been created and successfully built, add the Telerik namespace "Telerik.Windows.Controls" in your XAML page. See the below screenshot for more details:
This will look as below:
Now add the telerik RadBusyIndicator as the root control of the MainPage. Replace Grid tag with the same. Here is the same:
Now add whatever you want to insert inside it. The content that is present inside the BusyIndicator will became disabled once the indicator enters into busy mode.
For our example, I created the below XAML code:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" x:Class="RadControlsSilverlightApp1.MainPage" Width="600"> <telerik:RadBusyIndicator x:Name="radBusyIndicator"> <StackPanel Orientation="Vertical" Margin="50"> <TextBlock Text="Working with the Telerik Rad BusyIndicator Control" FontSize="32" TextAlignment="Center" TextWrapping="Wrap" FontWeight="Bold" Foreground="Red"> <TextBlock.Effect> <DropShadowEffect/> </TextBlock.Effect> </TextBlock> <telerik:RadButton Content="Show Busy" HorizontalAlignment="Center" Width="100" Margin="20" Click="RadButton_Click"/> </StackPanel> </telerik:RadBusyIndicator> </UserControl>
We will not create a stunning UI for this sample project. Hence, we are going with a TextBlock and a Button control. Once we click on the button, the rad busy indicator will enter into the busy mode.
Playing with CodeAs the UI is ready, we need to write a sample code to test the BusyIndicator. To do this, add the click event of the Button and write the following code in the event implementation:
To start the busy indicator, just set IsBusy to true and set it to false, when you want to close it.
Let's run our sample application. You will see the following screen inside your browser window:
Click on the "Show Busy" button to load the busy indicator.
You will now see that the busy indicator loaded into the UI and disabled the visible area which was surrounded by the RadBusyIndicator control. The progress bar that loads into the UI has a circular progress control. Check it here:
The progress bar will move in circular direction while in busy mode.
Now, do you want to change the text? By default, it shows "Loading..." as the content. You can change it to some other strings also. Have a look:
To do it, just set the BusyContent property of the indicator control. That will do the trick for you. You can either set it in the XAML or set in the code behind before doing the call. Let's have a look of it here:
You might also ask, is it possible to put a cancel button there too? Yes, why not!!! You can set any nos. of control there instead of just the simple text. So, how to do this?
To do it, edit the Busy Indicator's BusyContentTemplate and modify the template there. You can bind any data there too. Have a look into the following XAML code for more details:
End NoteHope, this information will help you when you work with the Silverlight BusyIndicator, mainly the control that comes with the Telerik RadControls library. Enjoy reading my other articles too. I will continue for sometime exploring the telerik rad controls from now and will try to post them for you, so that, you will get some help from there while working with them.
Don't forget to vote for it and leave your feedback. Suggestions are always welcome.
Really enjoyed this post.Really thank you! Keep writing. makaberzux
What as up everyone, it as my first visit at this web page, and piece of writing is actually fruitful designed for me, keep up posting such posts.
I went over this site and I think you have a lot of good information, saved to my bookmarks (:.
There is perceptibly a bundle to identify about this. I feel you made certain nice points in features also.
Really enjoyed this article post.Really thank you! Really Cool.
Updating your website frequently helps build your
Simply a smiling visitor here to share the love (:, btw outstanding style and design.
Your style is so unique compared to other folks I ave read stuff from. Many thanks for posting when you ave got the opportunity, Guess I will just bookmark this page.
You ave made some decent points there. I looked on the internet for more information about the issue and found most people will go along with your views on this website.
It'аs really a cool and useful piece of information. I'аm happy that you shared this helpful information with us. Please stay us up to date like this. Thanks for sharing.
This is one awesome blog.Really looking forward to read more. Cool.
Say, you got a nice blog post.Much thanks again. Will read on
Real good info can be found on website. Even if happiness forgets you a little bit, never completely forget about it. by Donald Robert Perry Marquis.
using? Can I get your affiliate link to your host? I wish my website
When someone writes an article he/she retains the image of a user
Major thankies for the post. Will read on
You ave a really nice layout for the blog i want it to make use of on my website also.
Thanks again for the article post.Much thanks again.
Muchos Gracias for your blog.Much thanks again. Want more.
Some genuinely choice content on this website , bookmarked.
It is in reality a great and useful piece of information. I'аm happy that you just shared this helpful info with us. Please keep us informed like this. Thank you for sharing.
Im thankful for the post.Much thanks again. Really Great.
wow, awesome blog post.Really looking forward to read more. Cool.
Usually I don at learn post on blogs, however I would like to say that this write-up very forced me to take a look at and do it! Your writing style has been amazed me. Thank you, quite nice article.
pretty helpful stuff, overall I believe this is well worth a bookmark, thanks
Yours is a prime example of informative writing. I think my students could learn a lot from your writing style and your content. I may share this article with them.
You made some respectable factors there. I looked on the internet for the problem and located most individuals will associate with along with your website.
It as nearly impossible to find well-informed people for this topic, however, you sound like you know what you are talking about! Thanks
Thanks for sharing, this is a fantastic blog post.Really thank you! Much obliged.
It as truly a nice and useful piece of info. I am satisfied that you simply shared this useful tidbit with us. Please keep us informed like this. Thanks for sharing.
PhMp9b This is very interesting, You are a very skilled blogger. I ave joined your feed and look forward to seeking more of your excellent post. Also, I ave shared your site in my social networks!
It'аs actually a nice and useful piece of information. I'аm satisfied that you shared this useful information with us. Please keep us up to date like this. Thank you for sharing.
Thank you ever so for you post.Really looking forward to read more. Much obliged.
Thanks-a-mundo for the blog article.Really looking forward to read more. Great.
you are really a good webmaster. The site loading speed is incredible. It seems that you are doing any unique trick. Moreover, The contents are masterpiece. you ave done a wonderful job on this topic!
Really appreciate you sharing this article.Really thank you! Really Cool.
Thanks-a-mundo for the article post.Much thanks again.
Really appreciate you sharing this post.Much thanks again. Cool.
writing like yours these days. I truly appreciate individuals like you! Take care!! Feel free to visit my blog post aarp life insurance
It as onerous to search out knowledgeable people on this subject, however you sound like you already know what you are speaking about! Thanks
Major thanks for the blog article. Fantastic.
space to unravel my problem. May be that as you! Looking forward to look you.
Very informative blog post.Really looking forward to read more. Great.
My partner and I stumbled over here by a different page and thought I might as well check things out. I like what I see so now i am following you. Look forward to looking into your web page yet again.
It is best to take part in a contest for among the finest blogs on the web. I all advocate this website!
Way cool! Some very valid points! I appreciate you writing this article plus the rest of the website is also very good.
This website definitely has all of the information and facts I wanted concerning this subject and didn at know who to ask.
Well I sincerely enjoyed studying it. This tip procured by you is very useful for good planning.
you ave got a great weblog here! would you like to make some invite posts on my weblog?
Wow, awesome weblog structure! How long have you ever been running a blog for? you make running a blog look easy. The total look of your website is excellent, let alone the content!