Click here to Skip to main content
13,201,763 members (71,299 online)
Click here to Skip to main content
Add your own
alternative version


17 bookmarked
Posted 5 May 2008

Waiting Control / IE 7 Progressbar Control using WPF

, 13 May 2008
Rate this:
Please Sign up or sign in to vote.
Timeless or non-progress based waiting / progress control using WPF


This article deals with the full coding and implementation of a waiting control in WPF.


Download - 302.64 KB


Gone are those days when we used hour glass to show a busy status; we live in the arena of WPF. I wanted to implement a UI which looks like a progress bar in IE 7. This is particularly very useful when we can't estimate the progress. eg) A search page which pulls the data from the database can be never estimated that the result will be returned in 1 sec or 10 sec.

I googled a lot to get some help on this. Being my whole effort in vain, I finally settled down in building my own. I am sure that this code should help a few developers.

Using the code

The code is straight forward which has two circles filled with gradient color and a story board which runs endless, unless stopped. You can change the color, gradient etc as you wish.

The attached project comes with a Control library (the control itself) and a sample application which implements the control.

    <Storyboard x:Key="Spin" x:Name="Spin"> 
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 

        RepeatBehavior="Forever" Storyboard.TargetName="path" 

            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> 
            <SplineDoubleKeyFrame KeyTime="00:00:00.7000000" Value="360"/>

The above storyboard rotates the doughnut shaped control by 360° in .7 seconds and repeats the animation forever.

    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> 
        <GradientStop Color="#FF000000" Offset="0"/> 
        <GradientStop Color="#FFC5D1F9" Offset="1"/> 

The above XAML should be your part of interest if you want to change the color. I would recommend using Microsoft Expression Blends for this.

13 routed events are implemented for the control which triggers on the 4 actions namely Start, End, Pause, Resume. The State property gives the state of the control.

ThrowsErrorOnInvalidOperation property gets / sets whether an invalid operation error is to be thrown eg) resume operation is invalid unless the control is paused.

Points of Interest

I struggled a lot before I could implement the routed events. I guess that this project should be a perfect one to learn on "Implementing routed events in your control".

Please feel free to write me in case of any support needed on this context. I would also like to hear from you, if this code was useful.


Version : Control released with Start, End methods with its events

Version :

  • Control released with Start, End, Pause, Resume methods and corresponding events.
  • State property implemented.
  • Invalid operation errors are introduced.

Version :

  • Bugs fixed with the newly added methods.
  • Event names changed as per microsoft standards.
  • ThrowsErrorOnInvalidOperation property added.

Download - 302.64 KB


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Microsoft Corporation
India India
I work for Microsoft on MS technologies for application development. My interests include .net, WCF, Azure, Windows Phone,, SL, WCF, WPF and many more.

You can visit my site at

Follow me on twitter @jebarson007

You may also be interested in...


Comments and Discussions

QuestionToolstrip Pin
Tehtom4-Aug-09 0:52
memberTehtom4-Aug-09 0:52 
GeneralVery nice! Pin
-=Deriven6-Dec-08 17:35
member-=Deriven6-Dec-08 17:35 
GeneralYes! It is useful to me. Pin
Member 32888616-May-08 18:28
memberMember 32888616-May-08 18:28 
GeneralRe: Yes! It is useful to me. Pin
jebarson7-May-08 11:16
memberjebarson7-May-08 11:16 
NewsRe: Yes! It is useful to me. Pin
jebarson19-May-08 6:32
memberjebarson19-May-08 6:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171020.1 | Last Updated 13 May 2008
Article Copyright 2008 by jebarson
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid