Skip to main content
Version: 11.0.x

ProgressBar

The ProgressBar presents a value as a proportionately filled bar with the option to show a caption.

Useful Properties

You will probably use these properties most often:

PropertyDescription
MinimumMinimum value.
MaximumMaximum value.
ValueCurrent value.
ForegroundThe bar color.
ShowProgressTextThe progress bar shows progress as a text caption.
ProgressTextFormatThe format string applied to the progress text.

Example

<StackPanel Margin="20">
<ProgressBar Margin="0 10" Height="20"
Minimum="0" Maximum="100" Value="14"
ShowProgressText="True"/>
<ProgressBar Margin="0 10" Height="20"
Minimum="0" Maximum="100" Value="92"
Foreground="Red"
ShowProgressText="True"/>
</StackPanel>

ProgressTextFormat Example

By default, ShowProgressText shows the percentage completion according to the Value, Minimum, and Maximum. The format of this text can be customised by using the ProgressTextFormat property. This expects a string which will be passed to a string.Format call with the value of ProgressTextFormat as the format string. The following format items are available at the given indices:

  • 0 = Value
  • 1 = Value as a Percentage from 0 to 100 (e.g. Minimum = 0, Maximum = 50, Value = 25, then Percentage = 50)
  • 2 = Minimum
  • 3 = Maximum
MinMaxValueProgressTextFormatOutput
02017{}{0}/{3} Tasks Complete ({1:0}%)17/20 Tasks Complete (85%)

Since {0} would appear at the start of the string in this example, it must be escaped.

More Information

info

For the complete API documentation about this control, see here.

info

View the source code on GitHub ProgressBar.cs