ProgressBar
Determinate, indeterminate, and styled progress indicators.
Overview
The ProgressBar control displays a horizontal bar indicating progress.
It supports three modes: determinate (bound to a value 0-100),
indeterminate (animated marquee), and static with
customizable colors.
ViewModel (C#)
The ProgressValue property cycles from 0 to 100 using a timer,
demonstrating real-time data binding to the progress bar.
public class ProgressBarsViewModel : ViewModelBase, IDisposable
{
public double ProgressValue
{
get;
set => SetProperty(ref field, value);
}
private readonly Timer _timer;
public ProgressBarsViewModel()
{
_timer = new Timer(_ =>
{
ProgressValue = (ProgressValue + 2) % 102;
if (ProgressValue > 100) ProgressValue = 0;
}, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(500));
}
public void Dispose() => _timer.Dispose();
}
Key Concepts
Valueproperty (0-100) for determinate progressIsIndeterminate="True"for animated marquee modeShowPercentage="True"to display the percentage textForegroundandTrackForegroundfor color customization- Timer-based animation with
ViewModelBase.SetProperty IDisposablepattern for timer cleanup on navigation