Before reading this article, I highly recommend reading the previous parts of the series.
- Learn Universal Windows Programming Via Modern C++
- Learn Universal Windows Programming Via Modern C++ (Button Control)
- Learn Universal Windows Programming Via Modern C++ (StackPanel)
- Learn Universal Windows Programming Via Modern C++ (CheckBox)
- Learn Universal Windows Programming Via Modern C++ (RadioButton)
- Learn Universal Windows Programming Via Modern C++ (Combobox)
- Learn Universal Windows Programming Via Modern C++ (Border)
- Learn Universal Windows Programming Via Modern C++ (CommandBar)
- Learn Universal Windows Programming Via Modern C++ (SplitView Control)
- Learn Universal Windows Programming Via Modern C++ (AutoSuggestBox)
- Learn Universal Windows Programming Via Modern C++ (ContentDialog)
- Learn Universal Windows Programming Via Modern C++ (Grid Control)
- Learn Universal Windows Programming Via Modern C++ (RelativePanel)
ProgressBar control
ProgressBar indicates that some operation is going on in the background. Just update the graphical indication in the GUI, ex: Copy one folder to another folder. Windows OS shows in one popup window what’s going on.
In this article, I am going to explain how to implement ProgressBar control in Modern C++/WinRT.
ProgressBar has divided into two types.
- Repeating Style(Pattern)
- ProgressBar fill based on the value;
ProgressBar Repeating Style
To implement the repeating style, set IsIndeterminate value as true. That’s it. It will display the indication like below.
- ProgressBar pBar;
- pBar.IsIndeterminate(true);
- pBar.Foreground(SolidColorBrush(Colors::Red()));
ProgressBar is filled based on the value
This feature shows the percentage as a status (Fill the value) based on the value. To use this feature, we have to set the three important properties as given below.
Properties
- Minimum - Minimum value for Bar value
- Maximum - Maximum value for Bar.
- Value - Value is indicated current fill value (how many percents it has completed)
Note - Value property should be within Minimum and Maximum range.
- ProgressBar pBar;
- pBar.Minimum(0);
- pBar.Maximum(100);
- pBar.Value(value);

Let's see one simple example
Concept: If the background work ( Background: Click the button ) is completed 40%, then show percentage as RedColor. If 80% is completed, show it in yellow color, and if it is 100% completed, show the green color in the ProgressBar control.

Join the conversation! Your thoughts help the community grow.