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 ViewModel ReactiveProperties:

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

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

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

Computed Progress Values

Calculate progress from multiple ReactiveProperties:

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

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

Progress with Status Display

Combine progress bars with reactive labels:

new VerticalGroup(
    new Label().BindText(ViewModel.StatusMessage),
    new ProgressBar(ViewModel.Progress),
    new Label().BindText(
        ViewModel.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.