Skip to content

A collapsed indeterminate ProgressBar keeps animating (120 fps, ~15% CPU); WinUI switches it to Determinate #26375

Closed

Description

@MartinZikmund

Severity: High - anyone who hides a busy indicator by collapsing an indeterminate ProgressBar keeps paying ~120 fps of rendering and 8-18 % CPU for as long as the page lives, for nothing visible on screen (battery drain, wasted GPU).

Current behavior 🐛

An indeterminate ProgressBar that is Visibility.Collapsed stays in the Indeterminate visual state, so its forever storyboard keeps ticking. The window re-renders at display rate while nothing on screen changes.

Measured at runtime (Skia desktop, Windows, Release build of master 4636b705e97, frames counted from the frame-rate counter's frame generation over a 5 s idle window):

progressbar-indeterminate:            frames/s=120.0  cpu%=14.6
progressbar-indeterminate-turned-off: frames/s=0.0    cpu%=0.3    (IsIndeterminate=false)
progressbar-indeterminate-collapsed:  frames/s=118.0  cpu%=17.8   (IsIndeterminate=true, Visibility=Collapsed)

An earlier run gave 118.2 fps / 14.7 % CPU for the collapsed case, vs 0 fps when IsIndeterminate is cleared. The code path is shared Uno.UI code (not renderer specific), so other heads are likely affected too, but only Skia desktop was run.

Expected behavior 🎯

Same as WinUI: a collapsed ProgressBar leaves the Indeterminate* states and goes to the Determinate* states, so the animation stops. WinUI's ProgressBar registers a VisibilityProperty changed callback in its constructor, and UpdateStates() only picks the indeterminate states when IsIndeterminate() && Visibility() == Visible:

  • ProgressBar.cpp ctor, line 25: RegisterPropertyChangedCallback(winrt::UIElement::VisibilityProperty(), { this, &ProgressBar::OnVisibilityPropertyChanged });
  • OnVisibilityPropertyChanged just calls UpdateStates() (line 76-79)
  • UpdateStates(): if (IsIndeterminate() && Visibility() == winrt::Visibility::Visible) (line 89)

This is backed by the WinUI C++ sources (read, not run against native WinUI).

How to reproduce it 🔬

  1. Create an app with this page content (any Uno app on Skia desktop):
var pb = new ProgressBar { IsIndeterminate = true, Width = 300, VerticalAlignment = VerticalAlignment.Top };
var root = new Grid();
root.Children.Add(pb);
Window.Content = root;
// after the bar is shown:
pb.Visibility = Visibility.Collapsed;
  1. Wait a couple of seconds and leave the window idle.
  2. Watch the frame-rate counter (Application.Current.DebugSettings.EnableFrameRateCounter = true) or the process CPU in Task Manager.

Result: frames keep flowing at display rate (~120 fps on the test machine) and the process uses a steady ~15 % CPU. Setting IsIndeterminate = false instead drops to 0 fps.

The visual state is also wrong: the collapsed bar stays in Indeterminate, where WinUI moves it to Determinate.

Workaround 🛠️

Clear IsIndeterminate when hiding the bar, or bind IsIndeterminate to the same flag as Visibility.

Works on UWP/WinUI

Yes, per the WinUI sources above (the animation stops when the bar is collapsed).

Renderer 🎨

Skia

Affected platforms 📱💻🖥️

Verified on Desktop (Windows, Skia). The logic is shared, so likely all platforms.

Uno.Sdk version (and other relevant versions) 📦

Uno master 4636b705e97 (net11.0-desktop, .NET SDK 11.0.100). ProgressBar.cs is unchanged on current master (46ea872727d).

Anything else we need to know? 💬

Root cause (source-backed): src/Uno.UI/UI/Xaml/Controls/ProgressBar/ProgressBar.cs registers property-changed callbacks for Value, Minimum, Maximum and Padding in the constructor (L31-L34) but none for Visibility, and UpdateStates() (L95) checks only IsIndeterminate.

Suggested fix (small, localized): port OnVisibilityPropertyChanged (register a VisibilityProperty callback calling UpdateStates()), and change the condition to IsIndeterminate && Visibility == Visibility.Visible.

Related but a different bug: #26166 (VisualStateGroup.CurrentState timing), which was probed using a collapsed ProgressBar.

Activity

  1. added
    kind/bug
    good first issue
    triage/untriaged
    area/skia ✏️
    platform/all
    difficulty/starter 🚀
    area/performance 📈
    low-hanging-🍒
    and removed
    good first issue
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/performance 📈area/skia ✏️difficulty/starter 🚀kind/buglow-hanging-🍒platform/alltriage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions