Table of Contents

Class ProgressBar

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Represents a progress bar control.

[DefaultBindingProperty("Value")]
[ControlCategory("Common")]
public class ProgressBar : Control, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo
Inheritance
ProgressBar
Implements

Examples

Here is how to declare a ProgressBar in UIXML:

<ProgressBar Name="progressBar" Margin="8" Minimum="50" Maximum="200" Value="125" ValueChanged="ProgressBar_ValueChanged" />

And the corresponding event handler in the code-behind:

private void ProgressBar_ValueChanged(object sender, EventArgs e)
{
    string text = progressBar.Value.ToString();
    MessageBox.Show(text, string.Empty);
}

Also, a ProgressBar can be created from code:

var progressBarControlNumericUpDown = new Alternet.UI.NumericUpDown() { Maximum = 10, Margin = new Thickness(0, 0, 0, 5) };
var progressBar = new Alternet.UI.ProgressBar() { Maximum = 10, Margin = new Thickness(0, 0, 0, 5) };

progressBarControlNumericUpDown.ValueChanged += (o, e) => progressBar.Value = (int)progressBarControlNumericUpDown.Value;
progressBarControlNumericUpDown.Value = 1;

Remarks

A ProgressBar control visually indicates the progress of a lengthy operation.

The Maximum and Minimum properties define the range of values to represent the progress of a task. The Minimum property is typically set to a value of 0, and the Maximum property is typically set to a value indicating the completion of a task. For example, to properly display the progress when copying a group of files, the Maximum property could be set to the total number of files to be copied. The Value property represents the progress that the application has made toward completing the operation. The value displayed by the ProgressBar only approximates the current value of the Value property. Based on the size of the ProgressBar, the Value property determines when to increase the size of the visually highlighted bar.

Examples of how a ProgressBar can look on different platforms:

Set Value property to specify the current position of the progress bar. A ProgressBar, like any other Control, can be disabled by setting its Enabled property to false.

Properties

ControlKind

Returns control identifier.

IsIndeterminate

Gets or sets whether the ProgressBar shows actual values or generic, continuous progress feedback.

Maximum

Gets or sets the maximum allowed value for the progress bar control.

Minimum

Gets or sets the minimum allowed value for the progress bar control.

Orientation

Gets or sets a value indicating the horizontal or vertical orientation of the progress bar.

Value

Gets or sets the current position of the progress bar.

Methods

CreateHandler()

Creates a handler for the control.

OnValueChanged(EventArgs)

Called when the value of the Value property changes.

RaiseValueChanged(EventArgs)

Raises the ValueChanged event and calls OnValueChanged(EventArgs).

Events

IsIndeterminateChanged

Occurs when the value of the Maximum property changes.

MaximumChanged

Occurs when the value of the Maximum property changes.

MinimumChanged

Occurs when the value of the Minimum property changes.

OrientationChanged

Occurs when the value of the Orientation property changes.

ValueChanged

Occurs when the value of the Value property changes.