Elements

ProgressBar

A progress indicator element that displays completion progress as a visual bar. Extends BaseElement functionality.

Constructor

new ProgressBar(0.5f); // 50% progress
new ProgressBar(); // 0% progress
new ProgressBar(observable); // Bound to observable

Examples

ReactiveProperty Progress Binding

ProgressBars display progress from ReactiveProperty fields:

var DownloadProgress = new ReactiveProperty<float>(0f);
var UploadProgress = new ReactiveProperty<float>(0f);
var PercentComplete = new ReactiveProperty<int>(0);

// Direct binding to progress property
new ProgressBar(DownloadProgress);

// Explicit binding
new ProgressBar()
    .BindProgress(UploadProgress);

// Transform percentage to float (0-1)
new ProgressBar()
    .BindProgress(PercentComplete.Select(p => p / 100f));

Computed Progress Values

Calculate progress from multiple ReactiveProperties:

var CurrentHealth = new ReactiveProperty<int>(80);
var MaxHealth = new ReactiveProperty<int>(100);

// Health bar from current/max health
new ProgressBar()
    .BindProgress(
        CurrentHealth.CombineLatest(MaxHealth)
            .Select(values => (float)values.First / values.Second)
    )
    .ClassName("health-bar");

// Task completion progress
var CompletedTasks = new ReactiveProperty<int>(3);
var TotalTasks = new ReactiveProperty<int>(10);

new ProgressBar()
    .BindProgress(
        CompletedTasks.CombineLatest(TotalTasks)
            .Select(values => (float)values.First / values.Second)
    );

Progress with Status Display

Combine progress bars with reactive labels:

var StatusMessage = new ReactiveProperty<string>("Downloading...");
var Progress = new ReactiveProperty<float>(0f);

new VerticalGroup(
    new Label().BindText(StatusMessage),
    new ProgressBar(Progress),
    new Label().BindText(
        Progress.Select(p => $"{p:P0} Complete")
    )
);

Properties

PropTypeDefault
progress?
float
0f
disabled?
bool
false
visible?
bool
true
name?
string
""
pickingMode?
PickingMode
PickingMode.Position

Methods

PropTypeDefault
Progress?
(float) => ProgressBar
-
GetProgress?
() => float
-
BindProgress?
(Observable<float>) => ProgressBar
-
Disabled?
(bool = true) => ProgressBar
-
GetDisabled?
() => bool
-
BindDisabled?
(Observable<bool>) => ProgressBar
-
Visible?
(bool) => ProgressBar
-
GetVisible?
() => bool
-
BindVisible?
(Observable<bool>) => ProgressBar
-
ClassName?
(string, bool = true) => ProgressBar
-
BindClassName?
(string, Observable<bool>) => ProgressBar
-
StyleSheet?
(StyleSheet) => ProgressBar or (string) => ProgressBar
-

ProgressBar extends BaseElement.