Blog

Windows 8 Progress Controls

By Ken Getz

windows 8 controls

XAML provides two controls specifically meant to indicate active progress, as some activity is running, to the user. The ProgressBar and ProgressRing controls can both display an indeterminate length for the activity, and the ProgressBar can display a specific value for its progress.

ProgressBar and ProgressRing

The ProgressBar control indicates the progress of an operation using one of two styles: Indeterminate, which displays a repeating pattern, or determinate, displaying specific values. Set the IsIndeterminate property to set the appearance of the ProgressBar control. When the property is False, the bar displays a specific value. In this state, you specify Minimum and Maximum properties for the ProgressBar. To specify progress, set the Value property.

The ProgressRing control works much like the ProgressBar control, except that it can only display in the indeterminate state. Use the IsActive property to control the visual state of the progress.

The figure below shows a determinate progress bar, with its value set for the purposes of the demo from a Slider control. The markup for those two controls looks like the following:

<StackPanel Orientation="Vertical" 
Margin="10"> 
<ProgressBar 
Minimum="0", Maximum="100" 
Value="{Binding ElementName=ProgressSlider, 
Path=Value}" 
Width="150"></ProgressBar> 
<Slider Minimum="0" 
x:Name="ProgressSlider" 
Maximum="100" 
Width="150" 
Value="20" 
Margin="0, 60, 0, 0" /> 
</StackPanel>



 

The figure below shows indeterminate ProgressBar and ProgressRing controls (it's hard to capture these in action).

 

Windows8 progress bar

 

The following markup generated these controls:

 
<StackPanel Orientation="Vertical" 
Margin="10, 10"> 
<ProgressBar Width="150" 
IsIndeterminate="True" /> 
</StackPanel> 
<StackPanel Orientation="Vertical" 
Margin="10, 10"> 
<ProgressRing IsActive="True" 
Width="50" 
Height="50" /> 
</StackPanel>

Thumbnail for 559This post is an excerpt from the online courseware for our Windows 8 Applications Using XAML: Apps and UI course written by expert Ken Getz.



Ken Getz

Ken Getz is a featured instructor for several of our Visual Studio courses. He is a Visual Basic and Visual C# expert and has been recognized multiple times as a Microsoft MVP. Ken is a seasoned instructor, successful consultant, and the author or co-author of several best-selling books. He is a frequent speaker at technical conferences like Tech-Ed, VSLive, and DevConnections and he has written for several of the industry's most-respected publications including Visual Studio Magazine, CoDe Magazine, and MSDN Magazine.


This blog entry was originally posted November 19, 2012 by Ken Getz

Windows 8 AppsWindows 8XAML