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
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
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
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
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
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
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
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
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@github-actions
Copy link
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"

jfversluis pushed a commit that referenced this pull request Mar 2, 2026
## What's Coming

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


## Animation
- [Android] Fixed TransformProperties issue when a wrapper view is
present by @Ahamed-Ali in #29228
  <details>
  <summary>🔧 Fixes</summary>

- [Android Image.Scale produces wrong
layout](#7432)
  </details>

## Button
- Fix ImageButton not rendering correctly based on its bounds by
@Shalini-Ashokan in #28309
  <details>
  <summary>🔧 Fixes</summary>

- [ImageButton dosen't scale Image
correctly](#25558)
- [ButtonImage width not sizing
correctly](#14346)
  </details>

## CollectionView
- [Android] Fixed issue where group Header/Footer template was applied
to all items when IsGrouped was true for an ObservableCollection by
@Tamilarasan-Paranthaman in #28886
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] Group Header/Footer Repeated for All Items When IsGrouped
is True for
ObservableCollection](#28827)
  </details>

- [Android] CollectionView: Fix reordering when using
DataTemplateSelector by @NanthiniMahalingam in
#32349
  <details>
  <summary>🔧 Fixes</summary>

- [[Android][.NET9] CollectionView Reorderer doesn't work when using
TemplateSelector](#32223)
  </details>

- [Android] Fix for incorrect scroll position when using ScrollTo with a
header in CollectionView by @SyedAbdulAzeemSF4852 in
#30966
  <details>
  <summary>🔧 Fixes</summary>

- [Potential off-by-one error when using ScrollTo in CollectionView with
a header.](#18389)
  </details>

- Fix Incorrect Scrolling Behavior in CollectionView ScrollTo Method
Using Index Value by @Shalini-Ashokan in
#27246
  <details>
  <summary>🔧 Fixes</summary>

- [CollectionView ScrollTo not working under
android](#27117)
  </details>

- [Android] Fix System.IndexOutOfRangeException when scrolling
CollectionView with image CarouselView by @devanathan-vaithiyanathan in
#31722
  <details>
  <summary>🔧 Fixes</summary>

- [System.IndexOutOfRangeException when scrolling CollectionView with
image CarouselView](#31680)
  </details>

- [Android] Fix VerticalOffset Update When Modifying
CollectionView.ItemsSource While Scrolled by @devanathan-vaithiyanathan
in #26782
  <details>
  <summary>🔧 Fixes</summary>

- [CollectionView.Scrolled event offset isn't correctly reset when items
change on Android](#21708)
  </details>

## Editor
- Fixed Editor vertical text alignment not working after toggling
IsVisible by @NanthiniMahalingam in
#26194
  <details>
  <summary>🔧 Fixes</summary>

- [Editor vertical text alignment not working after toggling
IsVisible](#25973)
  </details>

## Entry
- [Android] Fix Numeric Entry not accepting the appropriate Decimal
Separator by @devanathan-vaithiyanathan in
#27376
  <details>
  <summary>🔧 Fixes</summary>

- [Numeric Entry uses wrong decimal separator in MAUI app running on
Android](#17152)
  </details>

- [Android & iOS] Entry/Editor: Dismiss keyboard when control becomes
invisible by @prakashKannanSf3972 in
#27340
  <details>
  <summary>🔧 Fixes</summary>

- [android allows type into hidden Entry
control](#27236)
  </details>

## Gestures
- [Android] Fixed PointerGestureRecognizer not triggering PointerMoved
event by @KarthikRajaKalaimani in
#33889
  <details>
  <summary>🔧 Fixes</summary>

- [PointerGestureRecognizer does not fire off PointerMove event on
Android](#33690)
  </details>

- [Android] Fix PointerMoved and PointerReleased not firing in
PointerGestureRecognizer by @KarthikRajaKalaimani in
#34209
  <details>
  <summary>🔧 Fixes</summary>

- [PointerGestureRecognizer does not fire off PointerMove event on
Android](#33690)
  </details>

## Navigation
- [Android] Shell: Fix OnBackButtonPressed not firing for navigation bar
back button by @kubaflo in #33531
  <details>
  <summary>🔧 Fixes</summary>

- [OnBackButtonPressed not firing for Shell Navigation Bar button in
.NET 10 SR2](#33523)
  </details>

## Shell
- [iOS] Fixed Shell Navigating event showing same current and target
values by @Vignesh-SF3580 in #25749
  <details>
  <summary>🔧 Fixes</summary>

- [OnNavigating wrong target when tapping the same
tab](#25599)
  </details>

- [iOS, macOS] Fixed Shell Flyout Icon is always black in iOS 26 by
@Dhivya-SF4094 in #32997
  <details>
  <summary>🔧 Fixes</summary>

- [Shell Flyout Icon is always
black](#32867)
- [[iOS] Color Not Applied to Flyout Icon or Title on iOS
26](#33971)
  </details>

## TitleView
- [Android] Fixed duplicate title icon when setting TitleIconImageSource
Multiple times by @SubhikshaSf4851 in
#31487
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] Duplicate Title Icon Appears When Setting
NavigationPage.TitleIconImageSource Multiple
Times](#31445)
  </details>

## WebView
- Fixed the crash on iOS when setting HeightRequest on WebView inside a
ScrollView with IsVisible set to false by @Ahamed-Ali in
#29022
  <details>
  <summary>🔧 Fixes</summary>

- [Specifying HeightRequest in Webview when wrapped by ScrollView set
"invisible" causes crash in
iOS](#26795)
  </details>


<details>
<summary>🧪 Testing (3)</summary>

- [Testing] Fix for enable uitests ios26 by @TamilarasanSF4853 in
#33686
- [Testing] Fixed Test case failure in PR 34173 - [02/21/2026] Candidate
- 1 by @TamilarasanSF4853 in #34192
- [Testing] Fixed Test case failure in PR 34173 - [02/21/2026] Candidate
- 2 by @TamilarasanSF4853 in #34233

</details>

<details>
<summary>📦 Other (3)</summary>

- Fix Glide IllegalArgumentException in PlatformInterop for destroyed
activities by @jonathanpeppers via @Copilot in
#33805
- [iOS] Fix MauiCALayer and StaticCAShapeLayer crash on finalizer thread
by @pshoey in #33818
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] MauiCALayer and StaticCAShapeLayer crash on finalizer thread in
Release/AOT builds](#33800)
  </details>
- Merge branch 'main' into inflight/candidate in
1a00f12

</details>
**Full Changelog**:
main...inflight/candidate

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: jonathanpeppers <[email protected]>
Co-authored-by: pshoey <[email protected]>
Co-authored-by: Subhiksha Chandrasekaran <[email protected]>
Co-authored-by: devanathan-vaithiyanathan <[email protected]>
Co-authored-by: prakashKannanSf3972 <[email protected]>
Co-authored-by: Jakub Florkowski <[email protected]>
Co-authored-by: KarthikRajaKalaimani <[email protected]>
Co-authored-by: NanthiniMahalingam <[email protected]>
Co-authored-by: BagavathiPerumal <[email protected]>
Co-authored-by: Vignesh-SF3580 <[email protected]>
Co-authored-by: Shalini-Ashokan <[email protected]>
Co-authored-by: Tamilarasan Paranthaman <[email protected]>
Co-authored-by: SyedAbdulAzeemSF4852 <[email protected]>
Co-authored-by: Ahamed-Ali <[email protected]>
Co-authored-by: Dhivya-SF4094 <[email protected]>
Co-authored-by: Jakub Florkowski <[email protected]>
Co-authored-by: Matthew Leibowitz <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: TamilarasanSF4853 <[email protected]>
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

6 participants