Repository navigation
fix(progressring): Repaint when the assigned brush changes colour - #24613
Conversation
A ProgressRing pushes its colours into the animated visual only when the Foreground/Background dependency property itself changes. A brush mutated in place - the shape a re-evaluated theme resource takes - never reaches the ring, so it keeps painting the old colour. Rasterize a determinate ring, mutate the assigned brush's Color, and assert the ring repaints: the new colour appears and no pixel of the old one survives. Both tests fail today. Part of #24555 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
OnForegroundPropertyChanged/OnBackgroundPropertyChanged fired only when the dependency property itself changed, so a brush mutated in place never reached the animated visual and the ring kept its old colour. MUX's ProgressRing.cpp registers a change callback on the assigned brush for exactly this; the Uno port dropped it. Subscribe through Brush.SetupBrushChanged, as Shape, Border and TextBlock do. It also covers Opacity and gradient/acrylic fallback colours, which TryGetColorWithOpacity already reads but MUX's SolidColorBrush.Color-only callback would miss. The previous subscription is disposed before the new one is made, so a replaced brush stops driving the ring. fixes #24555 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24613/wasm-skia-net9/index.html |
Both counts now come from one screenshot, so the two assertions in a phase describe the same frame instead of three separately rasterized ones, and the tally is carried in named locals a breakpoint can read and in every assertion message. Addresses review feedback on #24613. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
The build 235325 found UI Test snapshots differences: Details
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24613/wasm-skia-net9/index.html |
|
The build 235351 found UI Test snapshots differences: Details
|
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
Before Recording.2026-09-24.122236.mp4After Recording.2026-09-24.122149.mp4 |
|
@Mergifyio backport servicing/6.8 |
✅ Backports have been createdDetails
|
…r-24613 fix(progressring): Repaint when the assigned brush changes colour (backport #24613)
|
@Mergifyio backport release/stable/6.7 |
✅ Backports have been createdDetails
|
…6.7/pr-24613 fix(progressring): Repaint when the assigned brush changes colour (backport #24613)
Both counts now come from one screenshot, so the two assertions in a phase describe the same frame instead of three separately rasterized ones, and the tally is carried in named locals a breakpoint can read and in every assertion message. Addresses review feedback on unoplatform#24613. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> (cherry picked from commit 1168878)
GitHub Issue: closes #24555
PR Type:
🐞 Bugfix
What changed? 🚀
Current behavior. A
ProgressRinghanded its colours to its animated visual only when theForegroundorBackgrounddependency property itself changed. If the property kept pointing at the same brush and that brush'sColorchanged, the ring went on painting the old colour indefinitely. This shows up in themed apps, where a brush resource is re-evaluated by mutating it in place rather than being replaced: every other control repaints, the ring does not. The only ways out were to force the property to change — toggleIsIndeterminateand back, or setForegroundtonulland back to the same brush.New behavior. The ring repaints in the brush's new colour, like every other control drawn with the same brush.
WinUI already does this —
ProgressRing.cppregisters a change callback on the assigned brush next to the property callback. The Uno port only ever had the property callback, since well before the recent Composition rework.Reviewer's guide
Start at
ProgressRing.cs:141-155— that is the whole fix. The two property-changed handlers went from a one-line push to dispose-then-resubscribe:Everything else in the diff is the four backing fields these need.
Nothing changed in the generated visuals or in
AnimatedVisualPlayer, deliberately. The push path already worked:SetColorPropertywrites into_themeProperties, the ring's brushes areExpressionAnimation-bound to that property set, andCompositionPropertySet.SetValueshort-circuits an unchanged value. Only the trigger was missing. The issue's own measurement shows this — settingForegroundtonulland back repainted correctly.Two choices worth a look:
Brush.SetupBrushChangedrather than a literal MUX transliteration. It is the mechanismShape,Border,TextBlockandTextBoxCorealready use, it is weak-event based, and it covers every brush kindTryGetColorWithOpacityreads —SolidColorBrush.ColorandBrush.Opacity,GradientBrush.FallbackColor,XamlCompositionBrushBase.FallbackColor. MUX watchesSolidColorBrush.Coloralone, so this is a deliberate superset.AnimatedIcon.cs:702-714rather thanProgressRing.cpp:74-82. MUX assigns the revoker only inside itsif, so moving to a brush that is not aSolidColorBrushleaves the old brush still driving the ring.The test that proves it is
Given_ProgressRing.When_Foreground_Brush_Colour_Mutated: it rasterizes a determinate ring, mutates the assigned brush'sColor, and asserts the new colour appears and no pixel of the old one survives.When_Background_Brush_Colour_Mutateddoes the same for the track ring. Both fail onmasteron the repaint assertion, having passed their baseline assertion first.Validation evidence
Compile —
SamplesApp.csproj -c Release -f net10.0-desktop: 0 warnings, 0 errors.Runtime, red phase (tests only, fix not applied) — both new tests failed on
CountPixels(SUT, IsLime) > 0, after passing their baseline assertion.Runtime, green phase — all 5 tests in
Given_ProgressRingpassed, including the 3 pre-existing ones.Runtime, regression sweep —
Given_ProgressRing_Visuals,Given_AnimatedVisualPlayer,Given_AnimatedAcceptVisualSource, MUXProgressRingTests, legacyWindows_UI_Xaml_Controls.Given_ProgressRing: 37 passed, 1 skipped (ProgressRingDefaultHeightShouldBe32, gated out by its own pre-existing#if !(__WASM__ || HAS_SKOTTIE)).All runs on Skia desktop (
net10.0-desktop).Known limitations
#if !__SKIA__ [Ignore], matching the siblingWhen_Stretch_Filland the#if __SKIA__wrapper onGiven_ProgressRing_Visuals. The issue was not checked on other targets either.DeterminateSource/IndeterminateSource, where WinUI deliberately does not (ProgressRing.cpp:92-102). That divergence predates this PR, but it now fires on every brush mutation rather than only on property changes. Correcting it is a behaviour change and wants its own issue rather than riding along in a bug fix.PR Checklist ✅
Screenshots Compare Test Runresults.