-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Indeterminate Progress Bar animation with CacheMode set up #10649
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10649 +/- ##
===================================================
+ Coverage 11.22814% 11.25824% +0.03010%
===================================================
Files 3352 3353 +1
Lines 668000 668062 +62
Branches 74980 74980
===================================================
+ Hits 75004 75212 +208
+ Misses 591745 591604 -141
+ Partials 1251 1246 -5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this, that was definitely an oversight by me.
// However, we can only allow ourselves to do that if the ProgressBar is not being cached, since when the UIElement is defined within | ||
// resources, IsVisible property will always evaluate to false as the UIElement is not a part of the visual tree at that point. (#8960) | ||
|
||
if (!IsIndeterminate || (!IsVisible && CacheMode is null)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to check if the ProgressBar
is part of the visual tree instead of checking CacheMode
?
Something like this:
if (!IsIndeterminate || (!IsVisible && CacheMode is null)) | |
if (!IsIndeterminate || (!IsVisible && VisualTreeHelper.GetParent(this) is not null)) |
I haven't tested it but to me it's more precise because the bug does not seem specific to `CacheMode`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThomasGoulet73 Maybe I scoped too narrowly, I'll check this but imho should work indeed.
Fixes #8960
Description
Adjusts the logic behind transitioning to
Determinate
state to avoid background animation to exclude a case when aCacheMode
is set up on theProgressBar
and theProgressBar
is not a part of the visual tree (IsVisible
evaluates tofalse
).It is worth nothing that the pre-NET 7.0 behaviour would work even without explicit
CacheMode
set-up. This basically provides a middle ground for the solution used commonly in applications, where explicitly setting upCacheMode
solves the immediate issue but if you had only used the resource as a target ofBitmapCacheBrush
, it will not work (which seems alright though).Imho that is an acceptable behavioral change from pre-NET7.0 behaviour and should be documented accordingly.
Customer Impact
If this change is not taken, customers will not be able to cache their indeterminate progress bars as they used to be.
Regression
Yeah, broken in #6266.
Testing
Local build, repro in #8960 and #6264.
Risk
Medium, we should have more test cases covering these kinda changes.
Microsoft Reviewers: Open in CodeFlow