Skip to content

Conversation

@NirmalKumarYuvaraj
Copy link
Contributor

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!

Description of Change

This pull request addresses an issue where the GraphicsView control did not properly apply or update its Background or BackgroundColor properties on iOS, macOS, and Windows platforms. The changes introduce a new test case to verify the fix, update platform-specific handlers to ensure backgrounds are rendered and updated correctly, and make sure the handler uses a container when needed for background rendering.

GraphicsView background rendering and updates:

  • Added a new test page (Issue31239) and corresponding drawable to verify that GraphicsView correctly applies and updates its Background and BackgroundColor properties. This includes a UI for dynamic property changes and a button to trigger updates.
  • Implemented a UI test (Issue31239) to automatically verify that background changes are visually applied, with screenshots before and after changing properties.

Platform handler improvements:

  • On Windows, overridden the NeedsContainer property in GraphicsViewHandler to return true when a background is set, ensuring proper rendering. [1] [2]
  • Updated the background mapping logic on Windows to refresh the container and update the background when the Background property changes.
  • On iOS, ensured that the platform view's background is updated and the drawable is invalidated when the Background property changes.

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Regression PR - #26368

Issues Fixed

Fixes #31239

Output

Before After
Before.mov
After.mov

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Aug 20, 2025
@jsuarezruiz jsuarezruiz added the area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing label Aug 26, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

return new PlatformTouchGraphicsView();
}

public override bool NeedsContainer => VirtualView?.Background is not null || base.NeedsContainer;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could include a comment here explaining why we require the Container with a Background?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz , Comment added. Please let me know if you have any concerns.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 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.

Pending snapshots on Mac and Windows.
image

Already available in the latest build. Could you commit the images?

@PureWeen PureWeen added this to the .NET 9 SR12 milestone Sep 9, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

override Microsoft.Maui.Handlers.GraphicsViewHandler.ConnectHandler(Microsoft.Maui.Platform.PlatformTouchGraphicsView! platformView) -> void
override Microsoft.Maui.Handlers.GraphicsViewHandler.CreatePlatformView() -> Microsoft.Maui.Platform.PlatformTouchGraphicsView!
override Microsoft.Maui.Handlers.GraphicsViewHandler.DisconnectHandler(Microsoft.Maui.Platform.PlatformTouchGraphicsView! platformView) -> void
override Microsoft.Maui.Handlers.GraphicsViewHandler.NeedsContainer.get -> bool
Copy link
Member

Choose a reason for hiding this comment

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

Don't add these to publish shipped

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@PureWeen , Modified changes.

@PureWeen PureWeen modified the milestones: .NET 9 SR12, .NET 10 SR1 Sep 10, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen modified the milestones: .NET 10 SR1, .NET 10.0 SR2 Nov 4, 2025
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

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

[iOS, Mac, Windows] GraphicsView does not change the Background/BackgroundColor

3 participants