Back to Devexpress

DxProgressBar.ProgressChanged Event

blazor-devexpress-dot-blazor-dot-dxprogressbar-d4a25e04.md

latest1.9 KB
Original Source

DxProgressBar.ProgressChanged Event

Fires after the progress value was changed.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public EventCallback<double> ProgressChanged { get; set; }

Parameters

TypeDescription
Double

Percentage progress.

|

Remarks

When the Value property is changed, the progress bar recalculates the percentage progress value. Handle the ProgressChanged event to respond to this progress change.

razor
<DxButton Text="Run Progress" Click="RunProgress" />
<span> Current value: @value (@(currentProgress+"%"))</span>
<DxProgressBar MinValue="100" 
               MaxValue="300" 
               Value="value" 
               ProgressChanged="ProgressChanged" 
               ShowLabel="false" />
@code {
    Double currentProgress { get; set; }
    int value = 100;
    bool running;

    private void RunProgress() {
        if (running) return;
        running = true;
        InvokeAsync(async () => {
            while (running && value < 300) {
                await Task.Delay(25);
                value++;
                StateHasChanged();
            }
            running = false;
        });
    }
    private void ProgressChanged(Double progress) {
        currentProgress = Math.Round(progress);
    }
}

See Also

DxProgressBar Class

DxProgressBar Members

DevExpress.Blazor Namespace