Repository navigation
fix(progressring): Repaint when the assigned brush changes colour (backport #24613) - #24693
Merged
agneszitte merged 3 commits intoOct 27, 2026
Merged
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]> (cherry picked from commit 9e90643)
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]> (cherry picked from commit 5a91237)
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]> (cherry picked from commit 1168878)
2 of 5 tasks
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24693/wasm-skia-net9/index.html |
MartinZikmund
approved these changes
Oct 7, 2026
MartinZikmund
enabled auto-merge
October 7, 2026 12:21
MartinZikmund
disabled auto-merge
October 7, 2026 12:21
Contributor
Author
|
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. |
This was referenced Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.This is an automatic backport of pull request #24613 done by [Mergify](https://mergify.com).