#1,030 – Displaying an Indeterminate Progress Bar

When you display a ProgressBar to show progress on some background task, you often know how much work needs to be done and how much of the work has already been done.  The ProgressBar below shows that we’ve loaded 5 out of 12 records, so the ProgressBar is 42% full.

1074-001

In other cases, you may want to use a ProgressBar to show the user that something is happening, but you might not know how long the operation will take or how much of the total work has already been done.  In these cases, you can display an “indeterminate” progress bar by setting the IsIndeterminate property to true.  A green bar will repeatedly slide across the face of the ProgressBar to show that something is happening.

        <ProgressBar IsIndeterminate="True"
                     Height="15" Margin="15,15,15,0"/>
        <Label Content="Connecting to database..."
               Margin="10,0"/>

1030-001
When the operation is done, you can just set IsIndeterminate to false and set Value to 0.