Skip to content

[Android] Fixed TransformProperties issue when a wrapper view is present#29228

Merged
jfversluis merged 9 commits intodotnet:inflight/currentfrom
Ahamed-Ali:fix-7432
Feb 20, 2026
Merged

[Android] Fixed TransformProperties issue when a wrapper view is present#29228
jfversluis merged 9 commits intodotnet:inflight/currentfrom
Ahamed-Ali:fix-7432

Conversation

@Ahamed-Ali
Copy link
Copy Markdown
Contributor

Root Cause of the issue

  • When a background color is applied to an image, the image is wrapped inside a container view(WrapperView). However, when scaling is applied to the image, the container view (WrapperView) does not account for the scaling, resulting in incorrect rendering.

Description of Change

  • Apply the scaling to the container view itself when a background color is present, ensuring proper rendering and consistent behavior.

Issues Fixed

Fixes #7432

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Apr 28, 2025
@Ahamed-Ali Ahamed-Ali marked this pull request as ready for review April 29, 2025 09:19
Copilot AI review requested due to automatic review settings April 29, 2025 09:19
@Ahamed-Ali Ahamed-Ali requested a review from a team as a code owner April 29, 2025 09:19
Copy link
Copy Markdown
Contributor

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.

Pull Request Overview

This PR fixes the issue where the scaling transformation was not applied correctly when an image is wrapped inside a container view (WrapperView) on Android. The changes update the transform properties calculation to apply these properties to the WrapperView instead of the inner view and add corresponding UI tests to validate the fix.

  • Calculate pivot points and other transform properties based on the actual view (either the WrapperView or the original view).
  • When a WrapperView is detected, apply transform properties on it and reset non-transform values on the inner view.
  • Added automated tests in both the shared and host app test suites to verify the corrected behavior.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Core/src/Platform/Android/ViewExtensions.cs Updated transform properties calculations to account for WrapperView presence
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7432.cs Added automated UI test for Issue7432
src/Controls/tests/TestCases.HostApp/Issues/Issue7432.cs Added test UI page for Issue7432 to simulate the issue

Comment on lines +32 to +34
var pivotX = (float)(view.AnchorX * transformView.ToPixels(view.Frame.Width));
var pivotY = (float)(view.AnchorY * transformView.ToPixels(view.Frame.Height));

Copy link

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

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

Ensure that using 'transformView' for calculating pivot accurately reflects the intended pixel conversion when a WrapperView is present. Verify that the view.Frame dimensions used remain valid for the WrapperView's coordinate context.

Suggested change
var pivotX = (float)(view.AnchorX * transformView.ToPixels(view.Frame.Width));
var pivotY = (float)(view.AnchorY * transformView.ToPixels(view.Frame.Height));
float pivotX, pivotY;
if (wrapperView is not null)
{
// Use WrapperView's coordinate context for pixel conversion
pivotX = (float)(view.AnchorX * wrapperView.ToPixels(view.Frame.Width));
pivotY = (float)(view.AnchorY * wrapperView.ToPixels(view.Frame.Height));
}
else
{
// Use platformView's coordinate context for pixel conversion
pivotX = (float)(view.AnchorX * platformView.ToPixels(view.Frame.Width));
pivotY = (float)(view.AnchorY * platformView.ToPixels(view.Frame.Height));
}

Copilot uses AI. Check for mistakes.
@jsuarezruiz jsuarezruiz added area-animation Animation, Transitions, Transforms platform/android labels Apr 30, 2025
wrapperView.PivotY = pivotY;

// Apply non-transform properties to the inner view
PlatformInterop.Set(platformView,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is duplicated two times, can create a method with all the transformation properties as parameters?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have made the changes. please let me know if you have any other concerns. @jsuarezruiz

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

The test PropertiesShouldBeCorrectlyApplied, related with transformations, is failing on Android.
image
Could you review if is related with the changes?

@Ahamed-Ali
Copy link
Copy Markdown
Contributor Author

The test PropertiesShouldBeCorrectlyApplied, related with transformations, is failing on Android. image Could you review if is related with the changes?

I have resaved the correct image. @jsuarezruiz

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 9, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 29228

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 29228"

evgenygunko pushed a commit to evgenygunko/CopyWordsDA that referenced this pull request Mar 11, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [Microsoft.Extensions.Logging.Debug](https://dot.net/) ([source](https://github.com/dotnet/dotnet)) | nuget | patch | `10.0.3` -> `10.0.4` |
| [Microsoft.Maui.Controls](https://github.com/dotnet/maui) | nuget | patch | `10.0.41` -> `10.0.50` |

---

### Release Notes

<details>
<summary>dotnet/maui (Microsoft.Maui.Controls)</summary>

### [`v10.0.50`](https://github.com/dotnet/maui/releases/tag/10.0.50)

[Compare Source](dotnet/maui@10.0.41...10.0.50)

#### What's Changed

.NET MAUI 10.0.50 introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 78 commits with various improvements, bug fixes, and enhancements.

#### AI

-   Enable packing and independent preview versioning for Essentials.AI by [@&#8203;mattleibow](https://github.com/mattleibow) in dotnet/maui#33976

-   Move Essentials.AI preview iteration to eng/Versions.props by [@&#8203;mattleibow](https://github.com/mattleibow) in dotnet/maui#34025

-   \[Feature] Add Microsoft.Maui.Essentials.AI - Apple Intelligence by [@&#8203;mattleibow](https://github.com/mattleibow) in dotnet/maui#33519

#### Ai Agents

-   Copilot agent infrastructure, emulator reliability, and try-fix workflow improvements by [@&#8203;PureWeen](https://github.com/PureWeen) via [@&#8203;Copilot](https://github.com/Copilot) in dotnet/maui#33937

-   Update PR agent models to claude-sonnet-4.6 and gpt-5.3-codex by [@&#8203;kubaflo](https://github.com/kubaflo) in dotnet/maui#34109

-   ci-copilot: set pipeline run title early using build.updatebuildnumber by [@&#8203;jfversluis](https://github.com/jfversluis) via [@&#8203;Copilot](https://github.com/Copilot) in dotnet/maui#34156

-   Revamp find-reviewable-pr skill: priorities, defaults, and doc fixes by [@&#8203;PureWeen](https://github.com/PureWeen) in dotnet/maui#34160

-   Add correct CI pipeline names to Copilot instructions by [@&#8203;jfversluis](https://github.com/jfversluis) in dotnet/maui#34255

-   Add resilience to UI tests for frozen/unresponsive apps by [@&#8203;PureWeen](https://github.com/PureWeen) in dotnet/maui#34023

-   Copilot CI: Structured phase outputs, autonomous execution, iOS support, and CI pipeline by [@&#8203;kubaflo](https://github.com/kubaflo) in dotnet/maui#34040

-   Agent Workflow Metrics via GitHub Labels by [@&#8203;kubaflo](https://github.com/kubaflo) in dotnet/maui#33986

#### Animation

-   \[Android] Fixed TransformProperties issue when a wrapper view is present by [@&#8203;Ahamed-Ali](https://github.com/Ahamed-Ali) in dotnet/maui#29228

    <...
This was referenced Mar 11, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-animation Animation, Transitions, Transforms community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android Image.Scale produces wrong layout

8 participants