Skip to content

Conversation

dipeshmsft
Copy link
Member

@dipeshmsft dipeshmsft commented Feb 25, 2025

Fixes #10502

Description

As described in the issue description, LinearGradientBrushes ( LGB ) caches it bounds when we use Absolute MappingMode. However, when we apply transformations to the brush, the brush does not work work as expected. This PR removes the caching of the brush, thus resolving the issue.

Customer Impact

Developers using the LGB along with MappingMode=Absolute and RelativeTransform will get the correct behavior for the brush.

Regression

No

Testing

Not yet.

Risk

  • It will have a performance impact on the application using LGB with Absolute mapping mode.
  • Applications using LGB will get a different behavior now.
Microsoft Reviewers: Open in CodeFlow

@dipeshmsft dipeshmsft requested review from a team as code owners February 25, 2025 19:36
@dotnet-policy-service dotnet-policy-service bot added the PR metadata: Label to tag PRs, to facilitate with triage label Feb 25, 2025
@pchaurasia14 pchaurasia14 requested a review from Copilot February 28, 2025 07:23
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@h3xds1nz
Copy link
Member

@dipeshmsft I don't think I agree with this change.

Sure, it is unfortunate that it "does not work" with transformations but well, it is Absolute after all, you should be setting the bounds and not expecting adaptations to the current space with transformations. Imho just using wrong tool for the job.

@dipeshmsft
Copy link
Member Author

@h3xds1nz I came across this while fixing the borders in the new Fluent styles. WinUI uses the brush in the above syntax, and gets the expected behavior. I am not sure of there mechanism though.

I will try to look for other ways for fixing the usage.

@miloush
Copy link
Contributor

miloush commented Feb 28, 2025

I don't remember much honestly and will have to look once I am back travelling, but I don't think Absolute should depend on the size of the element, which is what I think @h3xds1nz is saying but what is happening. Certainly caching shouldn't affect the output, it should only save calculations.

Copy link

codecov bot commented Mar 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@9793b4e). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10506   +/-   ##
=======================================
  Coverage        ?   11.55%           
=======================================
  Files           ?     3214           
  Lines           ?   648518           
  Branches        ?    71516           
=======================================
  Hits            ?    74915           
  Misses          ?   572441           
  Partials        ?     1162           
Flag Coverage Δ
Debug 11.55% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dipeshmsft dipeshmsft merged commit 73c7e63 into dotnet:main Mar 11, 2025
8 checks passed
@dipeshmsft dipeshmsft deleted the fixing-lineargradientbrush-caching branch March 31, 2025 10:25
@github-actions github-actions bot locked and limited conversation to collaborators May 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected behavior when using LinearGradientBrush + RelativeTransform
7 participants