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 adds support for the Fill property to the BoxView control, allowing it to be filled with any Brush (including gradients), not just a solid color. It introduces the necessary property, binding, event handling, and updates to tests and sample code to demonstrate and validate the new functionality.

The most important changes are:

BoxView Fill Property Implementation:

  • Added a new bindable property FillProperty and corresponding Fill getter/setter to BoxView, enabling the use of any Brush (such as gradients) to fill the box. The property includes logic to manage event subscriptions for brush changes and resource updates. (src/Controls/src/Core/BoxView/BoxView.cs) [1] [2] [3] [4]
  • Updated the implementation of the IShapeView.Fill property to prioritize the new Fill property over the existing Color property. (src/Controls/src/Core/BoxView/BoxView.cs)

Event Handling and Resource Management:

  • Introduced the WeakBrushChangedProxy helper class to manage weak event subscriptions for brush property changes, ensuring proper resource cleanup and preventing memory leaks. (src/Controls/src/Core/Internals/WeakEventProxy.cs, moved from src/Controls/src/Core/Shapes/Shape.cs) [1] [2]
  • Ensured event handlers and resource listeners are added/removed as the Fill property changes, and cleaned up in the BoxView destructor. (src/Controls/src/Core/BoxView/BoxView.cs) [1] [2]

Public API Updates:

  • Registered the new Fill property and its accessors in the public API files for all supported platforms. [1] [2] [3] [4] [5] [6]

Test and Sample Enhancements:

  • Updated the BoxView sample view model and test page to support and demonstrate the new Fill property, including options for solid, linear, and radial gradient fills, and corresponding UI controls. (src/Controls/tests/TestCases.HostApp/FeatureMatrix/BoxView/BoxViewControlPage.xaml, src/Controls/tests/TestCases.HostApp/FeatureMatrix/BoxView/BoxViewViewModel.cs) [1] [2] [3] [4] [5]

Code Cleanup:

  • Removed the unused System.ComponentModel import and relocated the WeakBrushChangedProxy class from Shape.cs to a more appropriate location. (src/Controls/src/Core/BoxView/BoxView.cs, src/Controls/src/Core/Shapes/Shape.cs) [1] [2]

Issues Fixed

Fixes #2365

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

Hey there @@NirmalKumarYuvaraj! 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 Sep 26, 2025
@sheiksyedm sheiksyedm added the area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing label Sep 26, 2025
@NirmalKumarYuvaraj NirmalKumarYuvaraj marked this pull request as ready for review September 26, 2025 12:12
@Copilot Copilot AI review requested due to automatic review settings September 26, 2025 12:12
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.

Pull Request Overview

This PR adds support for the Fill property to the BoxView control, enabling it to be filled with any Brush (including gradients) instead of just solid colors. The implementation includes proper event handling, resource management, and comprehensive test coverage.

  • Adds a new Fill property to BoxView that accepts any Brush type
  • Implements proper event subscription and resource management for brush changes
  • Updates the IShapeView.Fill implementation to prioritize the new Fill property over the existing Color property

Reviewed Changes

Copilot reviewed 13 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Controls/src/Core/BoxView/BoxView.cs Core implementation of the Fill property with event handling and resource management
src/Controls/src/Core/Internals/WeakEventProxy.cs Adds WeakBrushChangedProxy class for managing brush change subscriptions
src/Controls/src/Core/Shapes/Shape.cs Removes duplicate WeakBrushChangedProxy class
src/Controls/src/Core/PublicAPI/*/PublicAPI.Unshipped.txt Updates public API surface for all platforms
src/Controls/tests/TestCases.HostApp/FeatureMatrix/BoxView/BoxViewViewModel.cs Adds view model support for Fill property with gradient brushes
src/Controls/tests/TestCases.HostApp/FeatureMatrix/BoxView/BoxViewControlPage.xaml Updates UI test page with Fill property binding and controls
src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/BoxViewFeatureTests.cs Adds new UI tests for Fill property functionality

/// <summary>Bindable property for <see cref="CornerRadius"/>.</summary>
public static readonly BindableProperty CornerRadiusProperty = CornerElement.CornerRadiusProperty;

/// <summary>Bindable property for <see cref="Color"/>.</summary>
Copy link
Preview

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

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

The XML documentation comment incorrectly refers to Color instead of Fill. It should read 'Bindable property for <see cref="Fill"/>.'

Suggested change
/// <summary>Bindable property for <see cref="Color"/>.</summary>
/// <summary>Bindable property for <see cref="Fill"/>.</summary>

Copilot uses AI. Check for mistakes.

<StackLayout Grid.Column="0"
Grid.Row="0"
Padding="20"
Spacing="10">
Copy link
Preview

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

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

The removal of Padding='20' from the left column StackLayout may affect the visual layout and spacing. This change appears unrelated to the Fill property implementation and could impact existing UI tests.

Suggested change
Spacing="10">
Spacing="10"
Padding="20">

Copilot uses AI. Check for mistakes.

<StackLayout Grid.Column="1"
Grid.Row="0"
Padding="20"
Spacing="1">
Copy link
Preview

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

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

The removal of Padding='20' from the right column StackLayout may affect the visual layout and spacing. This change appears unrelated to the Fill property implementation and could impact existing UI tests.

Suggested change
Spacing="1">
Spacing="1"
Padding="20">

Copilot uses AI. Check for mistakes.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

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.

Several tests failing on Android:
image
Around 7-8% difference between snapshots. Could you take a look?

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
None yet
Development

Successfully merging this pull request may close these issues.

3 participants