Skip to content

Conversation

@Dhivya-SF4094
Copy link
Contributor

@Dhivya-SF4094 Dhivya-SF4094 commented Oct 22, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details:

When a Rectangle inside an AbsoluteLayout is initially set to (0, 0, AutoSize, AutoSize) and later updated to (50, 50, 100, 100) at runtime, it appears blurred after the bounds change.

Root Cause

The issue occurs because the native view’s layer reuses previously rendered content and scales it instead of redrawing. Since the Draw(CGRect) method is not automatically called when bounds change, the default scaling behavior (UIViewContentMode.ScaleToFill) causes pixelation instead of a proper redraw.

Description of Change

Updated MauiShapeView on iOS/macOS to set ContentMode to UIViewContentMode.Redraw.
This ensures that the shape is redrawn cleanly whenever its bounds change, preventing blur or pixelation.

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed:

Fixes #32042

Screenshots

Before  After 
     

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Oct 22, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@Dhivya-SF4094! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Oct 22, 2025
@sheiksyedm sheiksyedm added area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing platform/ios labels Oct 22, 2025
{
BackgroundColor = UIColor.Clear;
// Redraw the shape when bounds change to prevent blur during resizing in container layouts.
ContentMode = UIViewContentMode.Redraw;
Copy link
Contributor

Choose a reason for hiding this comment

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

Mnnn, UIViewContentMode.Redraw triggers Draw(CGRect) every time bounds change, including:

  • Layout passes (multiple per frame)
  • Animations (60fps = 60 redraws/second)
  • Parent container resizing
  • Keyboard appearance/dismissal
  • Orientation changes
  • Safe area inset changes
  • ScrollView scrolling (if shape is inside)

Shape rendering is already expensive:

  • Path calculation
  • Fill rendering
  • Stroke rendering
  • Shadow/gradient effects
  • Anti-aliasing

For complex shapes (Polygon, Path with many points), this could cause performance issues. The key question is do all shapes have this blurring issue? If is only Rectangle, can move the fix to the Rectangle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rectangle appears blurred on iOS and macOS when its bounds are changed at runtime within an AbsoluteLayout

3 participants