Quickstart: adding progress controls (Windows Store apps using C#/VB/C++ and XAML)
Progress controls provide a way for you to indicate that your app is performing work, such as downloading images, loading files, or processing data. Here are the different progress control styles and how to add them to a Windows Store app using C++, C#, or Visual Basic.
Roadmap: How does this topic relate to others? See:
Objective: To use progress controls to a Windows Store app using C++, C#, or Visual Basic.
We assume that you can add controls to a basic Windows Store app using C++, C#, or Visual Basic. For instructions on adding a control, see Quickstart: Adding controls and handling events.
There are 3 styles of progress controls that indicate to the user when the amount of work to complete is known, when it isn’t, and whether the task is modal: the determinate progress bar style, the indeterminate progress bar style, and the indeterminate ring style.
|Determinate progress bar: Shows how much progress the app has made. As work progresses, a fill color expands from left to right until it fills the progress bar. It doesn't indicate whether the user can interact with the app like the indeterminate styles do.|
|Indeterminate progress bar: Indicates that users can interact with the UI while the task continues. In the animation, dots appear on the left and move to the right along a track until they reach the end of the track and disappear.|
|Indeterminate progress ring : Indicates that user activity is blocked until the app completes the task, that is, the activity is modal. In the animation, several dots move clockwise in a circle.|
A determinate progress bar shows how much progress the app has made. As work progresses , the bar fills up. If you can estimate remaining amount of work in time, bytes, files, or some other quantifiable units of measure, use a determinate progress bar.
The progress bar provides 3 properties for setting and determining progress:
A number that specifies the value of completion. The default value is 1.0.
A number that specifies the current progress. If you're showing the progress of a file download, this value might be the number of bytes downloaded (and then you set Maximum to the total number of bytes to download).
Specifies whether the progress bar is indeterminate. Set to false to create a determinate progress bar.
To create a determinate progress bar
- Add a ProgressBar control to your app.
- Set the IsIndeterminate property to false. This is the default value.
- If you don't want to use the default completion value of 1.0, you can change it by setting the Maximum property.
- Set the Value property to show progress.
The previous example showed how to specify the value of a progress bar in markup. In a real app, you use procedural code or data binding to update the value of the progress bar as a response to some indicator of progress. For example, if your progress bar indicates how many files have been downloaded, you update the value each time another file is downloaded.
To update the value of a determinate progress bar
- To update the Value of the ProgressBar in code, give the ProgressBar a name, and refer to it by name in your code.
This example updates the value of a the progress bar in code.
<ProgressBar x:Name="progressBar1" IsIndeterminate="False" Maximum="100" Height="10" Width="200"/>
- To update the Value through data binding, bind the Value property to a bindable property in your app.
This example updates the value of a the progress bar though data binding.
When you can't estimate how much work remains to finish a task and the task doesn't block user interaction, use an indeterminate progress bar. Instead of showing a bar that fills up as progress completes, an indeterminate progress bar shows an animation of dots moving from left to right.
To create an indeterminate progress bar
This example creates an indeterminate progress bar.
When you can't estimate how much work remains to finish a task and the task does block user interaction, use an indeterminate progress ring. An indeterminate progress ring shows an animate sequence of dots moving in a circle.
To create an indeterminate progress ring
This example creates an indeterminate progress ring.
You learned how to create different types of progress controls.
The next topic, the Guidelines and checklist for progress controls, goes into more detail about when and how to use the progress control.
Build date: 11/19/2013