Skip to content

ProgressBar

The ProgressBar widget displays a visual progress indicator with optional percentage text.

ProgressBar shows progress using filled and unfilled portions, with customizable colors and optional percentage display.

The current progress value. Must be between Minimum and Maximum.

progressBar.Value = 50;

The minimum value (default: 0).

progressBar.Minimum = 0;

The maximum value (default: 100).

progressBar.Maximum = 100;

Whether to display percentage text on the progress bar.

progressBar.ShowPercentage = true;

Color of the filled portion.

progressBar.FilledColor = Color.Green;

Color of the unfilled portion.

progressBar.UnfilledColor = Color.DarkGray;

Text color for percentage when displayed over filled portion.

progressBar.FilledTextColor = Color.White;

PercentageVerticalAlignment (VerticalAlignment)

Section titled “PercentageVerticalAlignment (VerticalAlignment)”

Vertical alignment of percentage text.

progressBar.PercentageVerticalAlignment = VerticalAlignment.Middle;

PercentageHorizontalAlignment (HorizontalAlignment)

Section titled “PercentageHorizontalAlignment (HorizontalAlignment)”

Horizontal alignment of percentage text.

progressBar.PercentageHorizontalAlignment = HorizontalAlignment.Center;

Increments the value by the specified amount.

progressBar.Increment(5);

Decrements the value by the specified amount.

progressBar.Decrement(5);

Sets the value to a specific percentage (0-100).

progressBar.SetPercentage(75); // Sets to 75%

Gets the current progress as a percentage (0-100).

double percent = progressBar.Percentage;

Raised when the value changes.

progressBar.ValueChanged += (value) =>
{
Console.WriteLine($"Progress: {value}");
};
var progressBar = new ProgressBar
{
X = 10,
Y = 5,
Width = 50,
Height = 1,
Value = 42,
ShowPercentage = true,
FilledColor = ColorHelper.FromRgb(100, 200, 100),
UnfilledColor = ColorHelper.FromRgb(50, 50, 50),
FilledTextColor = Color.White
};
// Update progress
progressBar.Value = 75;
progressBar.Increment(10);
progressBar.SetPercentage(90);